WPGlobus – Multilingual Everything! - Version 1.9.10

Version Description

Note that the new WPGlobus Options panel will work with the modern browsers only!

=

Download this release

Release Info

Developer tivnet
Plugin Icon 128x128 WPGlobus – Multilingual Everything!
Version 1.9.10
Comparing to
See all releases

Code changes from version 1.9.9 to 1.9.10

Files changed (51) hide show
  1. data/wpglobus-product-info.json +1 -1
  2. flags/us-uk.png +0 -0
  3. includes/admin/central/class-wpglobus-admin-central.php +2 -2
  4. includes/admin/class-wpglobus-about.php +2 -2
  5. includes/admin/class-wpglobus-admin-menu.php +15 -33
  6. includes/admin/class-wpglobus-admin-page.php +94 -5
  7. includes/admin/class-wpglobus-clean.php +3 -4
  8. includes/admin/class-wpglobus-customize-options.php +12 -13
  9. includes/admin/class-wpglobus-language-edit-request.php +255 -255
  10. includes/admin/class-wpglobus-language-edit.php +1 -1
  11. includes/admin/helpdesk/class-wpglobus-admin-helpdesk.php +9 -50
  12. includes/class-wpglobus-config.php +18 -6
  13. includes/class-wpglobus-post-types.php +70 -0
  14. includes/class-wpglobus.php +7 -12
  15. includes/css/images/wpglobus-logo.jpg +0 -0
  16. includes/css/wpglobus-options.css +314 -0
  17. includes/css/wpglobus-options.less +379 -0
  18. includes/css/wpglobus-options.min.css +1 -0
  19. includes/js/wpglobus-admin-47.js +1649 -1649
  20. includes/js/wpglobus-admin-47.min.js +1 -1
  21. includes/js/wpglobus-admin-49.js +1654 -1654
  22. includes/js/wpglobus-admin-49.min.js +1 -1
  23. includes/js/wpglobus-admin-debug.min.js +1 -1
  24. includes/js/wpglobus-admin.js +1601 -1601
  25. includes/js/wpglobus-admin.min.js +1 -1
  26. includes/js/wpglobus-clean.min.js +1 -1
  27. includes/js/wpglobus-customize-control.min.js +1 -1
  28. includes/js/wpglobus-customize-control140.min.js +1 -1
  29. includes/js/wpglobus-customize-control170.min.js +1 -1
  30. includes/js/wpglobus-customize-control190.min.js +1 -1
  31. includes/js/wpglobus-customize-options.js +410 -410
  32. includes/js/wpglobus-customize-options.min.js +1 -1
  33. includes/js/wpglobus-customize-preview.min.js +1 -1
  34. includes/js/wpglobus-form.min.js +1 -1
  35. includes/js/wpglobus-media-post-php.min.js +1 -1
  36. includes/js/wpglobus-media.min.js +1 -1
  37. includes/js/wpglobus-options.js +107 -0
  38. includes/js/wpglobus-options.min.js +1 -0
  39. includes/js/wpglobus-plugin-install.min.js +1 -1
  40. includes/js/wpglobus-vendor-acf.js +83 -23
  41. includes/js/wpglobus-vendor-acf.min.js +1 -1
  42. includes/js/wpglobus-vendor-aioseop.min.js +1 -1
  43. includes/js/wpglobus-widgets.min.js +1 -1
  44. includes/js/wpglobus-wpseo-21.min.js +1 -1
  45. includes/js/wpglobus-wpseo-22.min.js +1 -1
  46. includes/js/wpglobus-yoastseo-30.min.js +1 -1
  47. includes/js/wpglobus-yoastseo-31.min.js +1 -1
  48. includes/js/wpglobus-yoastseo-32.min.js +1 -1
  49. includes/js/wpglobus-yoastseo-33.min.js +1 -1
  50. includes/js/wpglobus-yoastseo-34.min.js +1 -1
  51. includes/js/wpglobus-yoastseo-38.min.js +1 -1
data/wpglobus-product-info.json CHANGED
@@ -1 +1 @@
1
- {"multilingual-woocommerce-nets-netaxept":{"title":"{:en}Multilingual WooCommerce Nets Netaxept{:}{:ru}\u041c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f WooCommerce Nets Netaxept{:}","_api_new_version":"1.0.3","_api_tested_up_to":"4.9.2"},"wpglobus-header-images":{"title":"{:en}WPGlobus Header Images{:}{:ru}WPGlobus Header Images{:}","_api_new_version":"1.1.0","_api_tested_up_to":"4.9.2"},"wpglobus-for-slider-revolution":{"title":"{:en}WPGlobus for Slider Revolution{:}{:ru}WPGlobus \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430 Slider Revolution{:}","_api_new_version":"1.5.0","_api_tested_up_to":"4.9.2"},"wpglobus-menu-visibility":{"title":"WPGlobus Menu Visibility","_api_new_version":"1.0.3","_api_tested_up_to":"4.9.2"},"wpglobus-language-widgets":{"title":"{:en}WPGlobus Language Widgets{:}{:ru}\u042f\u0437\u044b\u043a\u0438 WPGlobus \u0434\u043b\u044f \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432{:}","_api_new_version":"1.1.0","_api_tested_up_to":"4.9.2"},"wpglobus-for-bridge-theme":{"title":"{:en}WPGlobus for the \"Bridge\" theme{:}{:ru}WPGlobus \u0434\u043b\u044f \u0442\u0435\u043c\u044b Bridge{:}","_api_new_version":"1.1.0","_api_tested_up_to":"4.9.2"},"woocommerce-wpglobus":{"title":"{:en}WooCommerce WPGlobus Add-on{:}{:ru}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 WooCommerce WPGlobus{:}","_api_new_version":"3.1.1","_api_tested_up_to":"4.9.2"},"wpglobus-multi-currency":{"title":"{:en}WPGlobus Multi-Currency for WooCommerce{:}{:ru}WPGlobus - \u041c\u0443\u043b\u044c\u0442\u0438\u0432\u0430\u043b\u044e\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f WooCommerce{:}","_api_new_version":"1.1.0","_api_tested_up_to":"4.9.2"},"wpglobus-mobile-menu":{"title":"{:en}WPGlobus Mobile Menu{:}{:ru}WPGlobus Mobile Menu{:}","_api_new_version":"1.2.1","_api_tested_up_to":"4.9.2"},"wpglobus-plus":{"title":"{:en}WPGlobus Plus multilingual extension{:}{:ru}WPGlobus \u041f\u043b\u044e\u0441{:}","_api_new_version":"1.1.37","_api_tested_up_to":"4.9.2"}}
1
+ {"multilingual-woocommerce-nets-netaxept":{"title":"{:en}Multilingual WooCommerce Nets Netaxept{:}{:ru}\u041c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f WooCommerce Nets Netaxept{:}","_api_new_version":"1.0.3","_api_tested_up_to":"4.9.4"},"wpglobus-header-images":{"title":"{:en}WPGlobus Header Images{:}{:ru}WPGlobus Header Images{:}","_api_new_version":"1.1.0","_api_tested_up_to":"4.9.2"},"wpglobus-for-slider-revolution":{"title":"{:en}WPGlobus for Slider Revolution{:}{:ru}WPGlobus \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430 Slider Revolution{:}","_api_new_version":"1.5.0","_api_tested_up_to":"4.9.2"},"wpglobus-language-widgets":{"title":"{:en}WPGlobus Language Widgets{:}{:ru}\u042f\u0437\u044b\u043a\u0438 WPGlobus \u0434\u043b\u044f \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432{:}","_api_new_version":"1.1.0","_api_tested_up_to":"4.9.2"},"wpglobus-for-bridge-theme":{"title":"{:en}WPGlobus for the \"Bridge\" theme{:}{:ru}WPGlobus \u0434\u043b\u044f \u0442\u0435\u043c\u044b Bridge{:}","_api_new_version":"1.1.0","_api_tested_up_to":"4.9.2"},"woocommerce-wpglobus":{"title":"{:en}WooCommerce WPGlobus Add-on{:}{:ru}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 WooCommerce WPGlobus{:}","_api_new_version":"3.1.1","_api_tested_up_to":"4.9.2"},"wpglobus-multi-currency":{"title":"{:en}WPGlobus Multi-Currency for WooCommerce{:}{:ru}WPGlobus - \u041c\u0443\u043b\u044c\u0442\u0438\u0432\u0430\u043b\u044e\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f WooCommerce{:}","_api_new_version":"1.1.0","_api_tested_up_to":"4.9.2"},"wpglobus-plus":{"title":"{:en}WPGlobus Plus multilingual extension{:}{:ru}WPGlobus \u041f\u043b\u044e\u0441{:}","_api_new_version":"1.1.38","_api_tested_up_to":"4.9.4"},"wpglobus-menu-visibility":{"title":"WPGlobus Menu Visibility","_api_new_version":"1.2.0","_api_tested_up_to":"4.9.4"},"wpglobus-mobile-menu":{"title":"{:en}WPGlobus Mobile Menu{:}{:ru}WPGlobus Mobile Menu{:}","_api_new_version":"1.2.2","_api_tested_up_to":"4.9.4"}}
flags/us-uk.png ADDED
Binary file
includes/admin/central/class-wpglobus-admin-central.php CHANGED
@@ -26,7 +26,7 @@ if ( ! class_exists( 'WPGlobus_Admin_Central' ) ) :
26
 
27
  self::set_vars();
28
 
29
- add_action( 'admin_menu', array( __CLASS__, 'add_menu' ) );
30
 
31
  }
32
 
@@ -44,7 +44,7 @@ if ( ! class_exists( 'WPGlobus_Admin_Central' ) ) :
44
 
45
  /**
46
  * Add a hidden admin menu item.
47
- * It will become visible in @see WPGlobus_Admin_HelpDesk::show_submenu
48
  */
49
  public static function add_menu() {
50
  add_submenu_page(
26
 
27
  self::set_vars();
28
 
29
+ add_action( 'admin_menu', array( __CLASS__, 'add_menu' ), PHP_INT_MAX );
30
 
31
  }
32
 
44
 
45
  /**
46
  * Add a hidden admin menu item.
47
+ * It serves as a base for several admin tabs, but currently do not have the "root" content.
48
  */
49
  public static function add_menu() {
50
  add_submenu_page(
includes/admin/class-wpglobus-about.php CHANGED
@@ -50,7 +50,7 @@ class WPGlobus_About {
50
  <?php WPGlobus_Admin_Page::nav_tab_icon_e( 'FAQ' ); ?>
51
  <?php esc_html_e( 'FAQ', 'wpglobus' ); ?>
52
  </a>
53
- <a href="<?php echo esc_url( WPGlobus_Admin_HelpDesk::$admin_page_url ); ?>"
54
  class="nav-tab">
55
  <?php WPGlobus_Admin_Page::nav_tab_icon_e( 'Helpdesk' ); ?>
56
  <?php echo esc_html( WPGlobus_Admin_HelpDesk::$page_title ); ?>
@@ -120,7 +120,7 @@ class WPGlobus_About {
120
  target="_blank"><?php esc_html_e( 'Guide', 'wpglobus' ); ?></a></li>
121
  <li>&bull; <a href="<?php echo esc_url( WPGlobus_Utils::url_wpglobus_site() . 'faq/' . self::QA_CAMPAIGN ); ?>"
122
  target="_blank"><?php esc_html_e( 'FAQs', 'wpglobus' ); ?></a></li>
123
- <li>&bull; <a href="<?php echo esc_url( WPGlobus_Admin_HelpDesk::$admin_page_url ); ?>"
124
  target="_blank"><?php esc_html_e( 'Contact Us', 'wpglobus' ); ?></a></li>
125
  <li>&bull; <a href="https://wordpress.org/support/plugin/wpglobus/reviews/?filter=5"
126
  target="_blank"><?php esc_html_e( 'Please give us 5 stars!', 'wpglobus' ); ?></a>
50
  <?php WPGlobus_Admin_Page::nav_tab_icon_e( 'FAQ' ); ?>
51
  <?php esc_html_e( 'FAQ', 'wpglobus' ); ?>
52
  </a>
53
+ <a href="<?php echo esc_url( WPGlobus_Admin_Page::url_helpdesk() ); ?>"
54
  class="nav-tab">
55
  <?php WPGlobus_Admin_Page::nav_tab_icon_e( 'Helpdesk' ); ?>
56
  <?php echo esc_html( WPGlobus_Admin_HelpDesk::$page_title ); ?>
120
  target="_blank"><?php esc_html_e( 'Guide', 'wpglobus' ); ?></a></li>
121
  <li>&bull; <a href="<?php echo esc_url( WPGlobus_Utils::url_wpglobus_site() . 'faq/' . self::QA_CAMPAIGN ); ?>"
122
  target="_blank"><?php esc_html_e( 'FAQs', 'wpglobus' ); ?></a></li>
123
+ <li>&bull; <a href="<?php echo esc_url( WPGlobus_Admin_Page::url_helpdesk() ); ?>"
124
  target="_blank"><?php esc_html_e( 'Contact Us', 'wpglobus' ); ?></a></li>
125
  <li>&bull; <a href="https://wordpress.org/support/plugin/wpglobus/reviews/?filter=5"
126
  target="_blank"><?php esc_html_e( 'Please give us 5 stars!', 'wpglobus' ); ?></a>
includes/admin/class-wpglobus-admin-menu.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Show a sidebar menu item.
4
- * This is a workaround because the WPGlobus options panel is made by ReduxFramework.
5
  * @since 1.7.8
6
  */
7
 
@@ -14,39 +14,21 @@ class WPGlobus_Admin_Menu {
14
  * Static constructor.
15
  */
16
  public static function construct() {
17
- add_action( 'admin_footer', array( __CLASS__, '_add_ons' ),
18
- // Below the Help Desk
19
- PHP_INT_MAX - 10
20
- );
21
  }
22
 
23
- /**
24
- * "Add-ons" menu.
25
- */
26
- public static function _add_ons() {
27
- $icon_class = 'dashicons dashicons-before dashicons-admin-plugins';
28
- $menu_title = __( 'Add-ons', 'wpglobus' );
29
- $menu_tooltip = __( 'View free and premium WPGlobus extensions', 'wpglobus' );
30
- $admin_page_url = WPGlobus_Admin_Page::url_addons();
31
- ?>
32
- <script>
33
- jQuery(function ($) {
34
- $('#toplevel_page_wpglobus_options')
35
- .find("ul")
36
- .prepend($("<li>")
37
- .append($("<a>")
38
- .attr({
39
- href: "<?php echo $admin_page_url; // WPCS: XSS ok. ?>",
40
- title: "<?php echo esc_js( $menu_tooltip ); ?>"
41
- })
42
- .html(' <?php echo esc_js( $menu_title ); ?>')
43
- .prepend($("<span>")
44
- .attr({"class": "<?php echo esc_js( $icon_class ); ?>"})
45
- )
46
- )
47
- );
48
- });
49
- </script>
50
- <?php
51
  }
52
  }
1
  <?php
2
  /**
3
  * Show a sidebar menu item.
4
+ *
5
  * @since 1.7.8
6
  */
7
 
14
  * Static constructor.
15
  */
16
  public static function construct() {
17
+ add_action( 'admin_menu', array( __CLASS__, 'add_menu' ), PHP_INT_MAX );
 
 
 
18
  }
19
 
20
+ public static function add_menu() {
21
+ $icon_class = 'dashicons dashicons-before dashicons-admin-plugins';
22
+ $menu_title = __( 'Add-ons', 'wpglobus' );
23
+ add_submenu_page(
24
+ WPGlobus::OPTIONS_PAGE_SLUG,
25
+ $menu_title,
26
+ '<span class="' . esc_attr( $icon_class )
27
+ . '" style="vertical-align:middle"></span> '
28
+ . $menu_title,
29
+ 'administrator',
30
+ WPGlobus_Admin_Page::url_addons(true)
31
+ );
32
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
34
  }
includes/admin/class-wpglobus-admin-page.php CHANGED
@@ -18,7 +18,7 @@ class WPGlobus_Admin_Page {
18
  ?>
19
  <style>
20
  .wp-badge.wpglobus-badge {
21
- background: #ffffff url(<?php echo esc_url( $url_wpglobus_logo ); ?>) no-repeat;
22
  background-size: contain;
23
  }
24
  </style>
@@ -47,10 +47,14 @@ class WPGlobus_Admin_Page {
47
 
48
  /**
49
  * URL of the WPGlobus Add-ons page.
 
 
 
50
  * @return string
51
  */
52
- public static function url_addons() {
53
- return add_query_arg(
 
54
  array(
55
  'tab' => 'search',
56
  's' => 'WPGlobus',
@@ -58,14 +62,99 @@ class WPGlobus_Admin_Page {
58
  ),
59
  self_admin_url( 'plugin-install.php' )
60
  );
 
 
 
 
 
 
 
61
  }
62
 
63
  /**
64
  * URL of the WPGlobus Settings page.
 
65
  * @return string
66
  */
67
  public static function url_settings() {
68
- return admin_url( 'admin.php' ) . '?page=wpglobus_options';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  }
70
 
71
  /**
@@ -94,7 +183,7 @@ class WPGlobus_Admin_Page {
94
  }
95
 
96
  echo '<span class="dashicons ' . esc_attr( $icon_class ) .
97
- '" style="vertical-align: middle"></span>';
98
  }
99
  }
100
 
18
  ?>
19
  <style>
20
  .wp-badge.wpglobus-badge {
21
+ background: #ffffff url(<?php echo esc_url( $url_wpglobus_logo ); ?>) no-repeat;
22
  background-size: contain;
23
  }
24
  </style>
47
 
48
  /**
49
  * URL of the WPGlobus Add-ons page.
50
+ *
51
+ * @param bool $relative Set it to true to get the URL relative to the admin.
52
+ *
53
  * @return string
54
  */
55
+ public static function url_addons( $relative = false ) {
56
+
57
+ $url = add_query_arg(
58
  array(
59
  'tab' => 'search',
60
  's' => 'WPGlobus',
62
  ),
63
  self_admin_url( 'plugin-install.php' )
64
  );
65
+
66
+ if ( $relative ) {
67
+ $url = str_replace( self_admin_url(), '', $url );
68
+ }
69
+
70
+ return $url;
71
+
72
  }
73
 
74
  /**
75
  * URL of the WPGlobus Settings page.
76
+ *
77
  * @return string
78
  */
79
  public static function url_settings() {
80
+ return add_query_arg( 'page', WPGlobus::OPTIONS_PAGE_SLUG, admin_url( 'admin.php' ) );
81
+ }
82
+
83
+ /**
84
+ * URL of the WPGlobus Helpdesk page.
85
+ *
86
+ * @return string
87
+ * @since 1.9.10
88
+ */
89
+ public static function url_helpdesk() {
90
+ return add_query_arg( 'page', WPGlobus::PAGE_WPGLOBUS_HELPDESK, admin_url( 'admin.php' ) );
91
+ }
92
+
93
+ /**
94
+ * URL of the Clean-up Tool page.
95
+ *
96
+ * @return string
97
+ * @since 1.9.10
98
+ */
99
+ public static function url_clean_up_tool() {
100
+ return add_query_arg( 'page', WPGlobus::PAGE_WPGLOBUS_CLEAN, admin_url( 'admin.php' ) );
101
+ }
102
+
103
+ /**
104
+ * URL of the About page.
105
+ *
106
+ * @return string
107
+ * @since 1.9.10
108
+ */
109
+ public static function url_about() {
110
+ return add_query_arg( 'page', WPGlobus::PAGE_WPGLOBUS_ABOUT, admin_url( 'admin.php' ) );
111
+ }
112
+
113
+ /**
114
+ * URL of the Admin Central page.
115
+ *
116
+ * @param string $central_tab_id Tab on the page.
117
+ *
118
+ * @return string
119
+ * @since 1.9.10
120
+ */
121
+ public static function url_admin_central( $central_tab_id = '' ) {
122
+ return add_query_arg( 'page', WPGlobus::PAGE_WPGLOBUS_ADMIN_CENTRAL . '#' . $central_tab_id, admin_url( 'admin.php' ) );
123
+ }
124
+
125
+ /**
126
+ * URL of the Options Panel.
127
+ *
128
+ * @param string $tab Tab on the page.
129
+ *
130
+ * @return string
131
+ * @since 1.9.10
132
+ */
133
+ public static function url_options_panel( $tab = WPGlobus_Options::DEFAULT_TAB ) {
134
+
135
+ return add_query_arg( array(
136
+ 'page' => WPGlobus::OPTIONS_PAGE_SLUG,
137
+ 'tab' => $tab,
138
+ ), admin_url( 'admin.php' ) );
139
+ }
140
+
141
+ /**
142
+ * URL of the WPGlobus-Plus Panel.
143
+ *
144
+ * @param string $tab Tab on the page.
145
+ *
146
+ * @return string
147
+ * @since 1.9.10
148
+ */
149
+ public static function url_wpglobus_plus_panel( $tab = 'modules' ) {
150
+ if ( class_exists( 'WPGlobusPlus', false ) ) {
151
+ return add_query_arg( array(
152
+ 'page' => WPGlobusPlus::WPGLOBUS_PLUS_OPTIONS_PAGE,
153
+ 'tab' => $tab,
154
+ ), admin_url( 'admin.php' ) );
155
+ } else {
156
+ return admin_url();
157
+ }
158
  }
159
 
160
  /**
183
  }
184
 
185
  echo '<span class="dashicons ' . esc_attr( $icon_class ) .
186
+ '" style="vertical-align: middle"></span>';
187
  }
188
  }
189
 
includes/admin/class-wpglobus-clean.php CHANGED
@@ -595,14 +595,13 @@ if ( ! class_exists( 'WPGlobus_Clean' ) ) :
595
  class="nav-tab">
596
  <?php esc_html_e( 'Guide', 'wpglobus' ); ?>
597
  </a>
598
- <a href="admin.php?page=wpglobus_options" class="nav-tab">
599
  <?php esc_html_e( 'Settings' ); ?>
600
  </a>
601
- <a href="<?php echo WPGlobus_Admin_Page::url_addons(); // WPCS: XSS ok. ?>" class="nav-tab">
602
  <?php esc_html_e( 'Add-ons', 'wpglobus' ); ?>
603
  </a>
604
- <a href="<?php echo esc_url( $url_wpglobus_site_contact ); ?>"
605
- class="nav-tab">
606
  <?php esc_html_e( 'Support', 'wpglobus' ); ?>
607
  </a>
608
  </h2>
595
  class="nav-tab">
596
  <?php esc_html_e( 'Guide', 'wpglobus' ); ?>
597
  </a>
598
+ <a href="<?php echo esc_url( WPGlobus_Admin_Page::url_settings() ); ?>" class="nav-tab">
599
  <?php esc_html_e( 'Settings' ); ?>
600
  </a>
601
+ <a href="<?php echo esc_url( WPGlobus_Admin_Page::url_addons() ); ?>" class="nav-tab">
602
  <?php esc_html_e( 'Add-ons', 'wpglobus' ); ?>
603
  </a>
604
+ <a href="<?php echo esc_url( $url_wpglobus_site_contact ); ?>" class="nav-tab">
 
605
  <?php esc_html_e( 'Support', 'wpglobus' ); ?>
606
  </a>
607
  </h2>
includes/admin/class-wpglobus-customize-options.php CHANGED
@@ -983,17 +983,24 @@ if ( ! class_exists( 'WPGlobus_Customize_Options' ) ) :
983
  $post_types = get_post_types();
984
 
985
  $enabled_post_types = array();
 
986
  foreach ( $post_types as $post_type ) {
987
  /**
988
  * @see "SECTION: Post types" in includes\options\class-wpglobus-options.php for complete post type array.
989
  */
990
- if ( ! in_array( $post_type, array( 'attachment', 'revision', 'nav_menu_item', 'custom_css', 'customize_changeset', 'oembed_cache' ), true ) ) {
991
 
 
 
 
 
 
 
992
  if ( in_array( $post_type, array( 'post', 'page' ) ) ) {
993
  $enabled_post_types[ $post_type ] = $post_type;
994
  continue;
995
- }
996
-
997
  foreach ( WPGlobus::O()->vendors_scripts as $script => $status ) {
998
 
999
  if ( empty( $status ) ) {
@@ -1001,18 +1008,12 @@ if ( ! class_exists( 'WPGlobus_Customize_Options' ) ) :
1001
  }
1002
 
1003
  if ( $script == 'ACF' || $script == 'ACFPRO' ) {
1004
- /**
1005
- * get list @see class-wpglobus.php:145
1006
- */
1007
  if ( in_array( $post_type, array( 'acf-field-group', 'acf-field', 'acf' ) ) ) {
1008
  continue 2;
1009
  }
1010
  }
1011
 
1012
  if ( $script == 'WOOCOMMERCE' ) {
1013
- /**
1014
- * get list @see class-wpglobus.php:171
1015
- */
1016
  if ( in_array(
1017
  $post_type,
1018
  array(
@@ -1031,16 +1032,14 @@ if ( ! class_exists( 'WPGlobus_Customize_Options' ) ) :
1031
  }
1032
 
1033
  if ( $script == 'WPCF7' ) {
1034
- /**
1035
- * get list @see class-wpglobus.php:195
1036
- */
1037
  if ( in_array( $post_type, array( 'wpcf7_contact_form' ) ) ) {
1038
  continue 2;
1039
  }
1040
  }
1041
 
1042
  }
1043
-
 
1044
  $enabled_post_types[ $post_type ] = $post_type;
1045
 
1046
  }
983
  $post_types = get_post_types();
984
 
985
  $enabled_post_types = array();
986
+
987
  foreach ( $post_types as $post_type ) {
988
  /**
989
  * @see "SECTION: Post types" in includes\options\class-wpglobus-options.php for complete post type array.
990
  */
991
+ if ( ! in_array( $post_type, WPGlobus_Post_Types::hidden_types(), true ) ) {
992
 
993
+ /**
994
+ * Obsolete from 1.9.10.
995
+ * @todo Remove after testing.
996
+ */
997
+ /**
998
+
999
  if ( in_array( $post_type, array( 'post', 'page' ) ) ) {
1000
  $enabled_post_types[ $post_type ] = $post_type;
1001
  continue;
1002
+ }
1003
+
1004
  foreach ( WPGlobus::O()->vendors_scripts as $script => $status ) {
1005
 
1006
  if ( empty( $status ) ) {
1008
  }
1009
 
1010
  if ( $script == 'ACF' || $script == 'ACFPRO' ) {
 
 
 
1011
  if ( in_array( $post_type, array( 'acf-field-group', 'acf-field', 'acf' ) ) ) {
1012
  continue 2;
1013
  }
1014
  }
1015
 
1016
  if ( $script == 'WOOCOMMERCE' ) {
 
 
 
1017
  if ( in_array(
1018
  $post_type,
1019
  array(
1032
  }
1033
 
1034
  if ( $script == 'WPCF7' ) {
 
 
 
1035
  if ( in_array( $post_type, array( 'wpcf7_contact_form' ) ) ) {
1036
  continue 2;
1037
  }
1038
  }
1039
 
1040
  }
1041
+ // */
1042
+
1043
  $enabled_post_types[ $post_type ] = $post_type;
1044
 
1045
  }
includes/admin/class-wpglobus-language-edit-request.php CHANGED
@@ -1,255 +1,255 @@
1
- <?php
2
- /**
3
- * WPGlobus / Admin / Language Edit / Request
4
- * plugins/wpglobus/includes/admin/class-wpglobus-language-edit-request.php
5
- *
6
- * @package WPGlobus\Admin
7
- * @since 1.9.7.1
8
- */
9
-
10
- /**
11
- * Class WPGlobus_Language_Edit_Request
12
- */
13
- class WPGlobus_Language_Edit_Request {
14
-
15
- const NONCE_ACTION = 'wpglobus-language-edit';
16
-
17
- const ACTION_NONE = '';
18
-
19
- const ACTION_EDIT = 'edit';
20
-
21
- const ACTION_DELETE = 'delete';
22
-
23
- const ACTION_ADD = 'add';
24
-
25
- const ACTION_DONE = 'done';
26
-
27
- /**
28
- * GET['action']
29
- *
30
- * @var string
31
- */
32
- protected $action = self::ACTION_NONE;
33
-
34
- /**
35
- * GET['lang']
36
- *
37
- * @var string
38
- */
39
- protected $lang = '';
40
-
41
- /**
42
- * POST['submit']
43
- *
44
- * @var bool
45
- */
46
- protected $is_submit = false;
47
-
48
- /**
49
- * POST['delete']
50
- *
51
- * @var bool
52
- */
53
- protected $is_delete = false;
54
-
55
-
56
- /**
57
- * POST['wpglobus_language_code']
58
- *
59
- * @var string
60
- */
61
- protected $wpglobus_language_code = '';
62
-
63
- /**
64
- * POST['wpglobus_flags']
65
- *
66
- * @var string
67
- */
68
- protected $wpglobus_flags = '';
69
-
70
- /**
71
- * POST['wpglobus_language_name']
72
- *
73
- * @var string
74
- */
75
- protected $wpglobus_language_name = '';
76
-
77
- /**
78
- * POST['wpglobus_en_language_name']
79
- *
80
- * @var string
81
- */
82
- protected $wpglobus_en_language_name = '';
83
-
84
- /**
85
- * POST['wpglobus_locale']
86
- *
87
- * @var string
88
- */
89
- protected $wpglobus_locale = '';
90
-
91
- /**
92
- * WPGlobus_Language_Edit_Request constructor.
93
- */
94
- public function __construct() {
95
- $this->parse_request();
96
- }
97
-
98
- /**
99
- * Parse GET and POST.
100
- */
101
- protected function parse_request() {
102
-
103
- check_admin_referer( self::NONCE_ACTION );
104
-
105
- if ( isset( $_GET['action'] ) && is_string( $_GET['action'] ) ) { // WPCS: input var ok, sanitization ok.
106
- $action = sanitize_text_field( wp_unslash( $_GET['action'] ) ); // Input var okay.
107
- if ( in_array( $action, array(
108
- self::ACTION_ADD,
109
- self::ACTION_EDIT,
110
- self::ACTION_DELETE,
111
- self::ACTION_DONE,
112
- ), true ) ) {
113
- $this->action = $action;
114
- } else {
115
- $this->action = self::ACTION_NONE;
116
- }
117
- }
118
-
119
- if ( isset( $_GET['lang'] ) && is_string( $_GET['lang'] ) ) { // WPCS: input var ok, sanitization ok.
120
- $this->lang = sanitize_text_field( wp_unslash( $_GET['lang'] ) ); // Input var okay.
121
- }
122
-
123
- if ( isset( $_POST['submit'] ) ) { // Input var okay.
124
- $this->is_submit = true;
125
- }
126
-
127
- if ( isset( $_POST['delete'] ) ) { // Input var okay.
128
- $this->is_delete = true;
129
- }
130
-
131
- foreach (
132
- array(
133
- 'wpglobus_language_code',
134
- 'wpglobus_flags',
135
- 'wpglobus_language_name',
136
- 'wpglobus_en_language_name',
137
- 'wpglobus_locale',
138
- ) as $var_name
139
- ) {
140
- if ( isset( $_POST[ $var_name ] ) && is_string( $_POST[ $var_name ] ) ) { // WPCS: input var ok, sanitization ok.
141
- $this->$var_name = sanitize_text_field( wp_unslash( $_POST[ $var_name ] ) ); // Input var okay.
142
- }
143
- }
144
- }
145
-
146
- /**
147
- * Getter.
148
- *
149
- * @return string
150
- */
151
- public function get_action() {
152
- return $this->action;
153
- }
154
-
155
- /**
156
- * Getter.
157
- *
158
- * @return string
159
- */
160
- public function get_lang() {
161
- return $this->lang;
162
- }
163
-
164
- /**
165
- * Getter.
166
- *
167
- * @return bool
168
- */
169
- public function is_submit() {
170
- return $this->is_submit;
171
- }
172
-
173
- /**
174
- * Getter.
175
- *
176
- * @return bool
177
- */
178
- public function is_delete() {
179
- return $this->is_delete;
180
- }
181
-
182
- /**
183
- * Getter.
184
- *
185
- * @return string
186
- */
187
- public function get_wpglobus_language_code() {
188
- return $this->wpglobus_language_code;
189
- }
190
-
191
- /**
192
- * Getter.
193
- *
194
- * @return string
195
- */
196
- public function get_wpglobus_flags() {
197
- return $this->wpglobus_flags;
198
- }
199
-
200
- /**
201
- * Getter.
202
- *
203
- * @return string
204
- */
205
- public function get_wpglobus_language_name() {
206
- return $this->wpglobus_language_name;
207
- }
208
-
209
- /**
210
- * Getter.
211
- *
212
- * @return string
213
- */
214
- public function get_wpglobus_en_language_name() {
215
- return $this->wpglobus_en_language_name;
216
- }
217
-
218
- /**
219
- * Getter.
220
- *
221
- * @return string
222
- */
223
- public function get_wpglobus_locale() {
224
- return $this->wpglobus_locale;
225
- }
226
-
227
- public static function url_language_add() {
228
- $url = add_query_arg( array(
229
- 'page' => WPGlobus::LANGUAGE_EDIT_PAGE,
230
- 'action' => self::ACTION_ADD,
231
- ), admin_url( 'admin.php' ) );
232
-
233
- return wp_nonce_url( $url, self::NONCE_ACTION );
234
- }
235
-
236
- public static function url_language_edit( $language_code ) {
237
- $url = add_query_arg( array(
238
- 'page' => WPGlobus::LANGUAGE_EDIT_PAGE,
239
- 'lang' => $language_code,
240
- 'action' => self::ACTION_EDIT,
241
- ), admin_url( 'admin.php' ) );
242
-
243
- return wp_nonce_url( $url, self::NONCE_ACTION );
244
- }
245
-
246
- public static function url_language_delete( $language_code ) {
247
- $url = add_query_arg( array(
248
- 'page' => WPGlobus::LANGUAGE_EDIT_PAGE,
249
- 'lang' => $language_code,
250
- 'action' => self::ACTION_DELETE,
251
- ), admin_url( 'admin.php' ) );
252
-
253
- return wp_nonce_url( $url, self::NONCE_ACTION );
254
- }
255
- }
1
+ <?php
2
+ /**
3
+ * WPGlobus / Admin / Language Edit / Request
4
+ * plugins/wpglobus/includes/admin/class-wpglobus-language-edit-request.php
5
+ *
6
+ * @package WPGlobus\Admin
7
+ * @since 1.9.7.1
8
+ */
9
+
10
+ /**
11
+ * Class WPGlobus_Language_Edit_Request
12
+ */
13
+ class WPGlobus_Language_Edit_Request {
14
+
15
+ const NONCE_ACTION = 'wpglobus-language-edit';
16
+
17
+ const ACTION_NONE = '';
18
+
19
+ const ACTION_EDIT = 'edit';
20
+
21
+ const ACTION_DELETE = 'delete';
22
+
23
+ const ACTION_ADD = 'add';
24
+
25
+ const ACTION_DONE = 'done';
26
+
27
+ /**
28
+ * GET['action']
29
+ *
30
+ * @var string
31
+ */
32
+ protected $action = self::ACTION_NONE;
33
+
34
+ /**
35
+ * GET['lang']
36
+ *
37
+ * @var string
38
+ */
39
+ protected $lang = '';
40
+
41
+ /**
42
+ * POST['submit']
43
+ *
44
+ * @var bool
45
+ */
46
+ protected $is_submit = false;
47
+
48
+ /**
49
+ * POST['delete']
50
+ *
51
+ * @var bool
52
+ */
53
+ protected $is_delete = false;
54
+
55
+
56
+ /**
57
+ * POST['wpglobus_language_code']
58
+ *
59
+ * @var string
60
+ */
61
+ protected $wpglobus_language_code = '';
62
+
63
+ /**
64
+ * POST['wpglobus_flags']
65
+ *
66
+ * @var string
67
+ */
68
+ protected $wpglobus_flags = '';
69
+
70
+ /**
71
+ * POST['wpglobus_language_name']
72
+ *
73
+ * @var string
74
+ */
75
+ protected $wpglobus_language_name = '';
76
+
77
+ /**
78
+ * POST['wpglobus_en_language_name']
79
+ *
80
+ * @var string
81
+ */
82
+ protected $wpglobus_en_language_name = '';
83
+
84
+ /**
85
+ * POST['wpglobus_locale']
86
+ *
87
+ * @var string
88
+ */
89
+ protected $wpglobus_locale = '';
90
+
91
+ /**
92
+ * WPGlobus_Language_Edit_Request constructor.
93
+ */
94
+ public function __construct() {
95
+ $this->parse_request();
96
+ }
97
+
98
+ /**
99
+ * Parse GET and POST.
100
+ */
101
+ protected function parse_request() {
102
+
103
+ check_admin_referer( self::NONCE_ACTION );
104
+
105
+ if ( isset( $_GET['action'] ) && is_string( $_GET['action'] ) ) { // WPCS: input var ok, sanitization ok.
106
+ $action = sanitize_text_field( wp_unslash( $_GET['action'] ) ); // Input var okay.
107
+ if ( in_array( $action, array(
108
+ self::ACTION_ADD,
109
+ self::ACTION_EDIT,
110
+ self::ACTION_DELETE,
111
+ self::ACTION_DONE,
112
+ ), true ) ) {
113
+ $this->action = $action;
114
+ } else {
115
+ $this->action = self::ACTION_NONE;
116
+ }
117
+ }
118
+
119
+ if ( isset( $_GET['lang'] ) && is_string( $_GET['lang'] ) ) { // WPCS: input var ok, sanitization ok.
120
+ $this->lang = sanitize_text_field( wp_unslash( $_GET['lang'] ) ); // Input var okay.
121
+ }
122
+
123
+ if ( isset( $_POST['submit'] ) ) { // Input var okay.
124
+ $this->is_submit = true;
125
+ }
126
+
127
+ if ( isset( $_POST['delete'] ) ) { // Input var okay.
128
+ $this->is_delete = true;
129
+ }
130
+
131
+ foreach (
132
+ array(
133
+ 'wpglobus_language_code',
134
+ 'wpglobus_flags',
135
+ 'wpglobus_language_name',
136
+ 'wpglobus_en_language_name',
137
+ 'wpglobus_locale',
138
+ ) as $var_name
139
+ ) {
140
+ if ( isset( $_POST[ $var_name ] ) && is_string( $_POST[ $var_name ] ) ) { // WPCS: input var ok, sanitization ok.
141
+ $this->$var_name = sanitize_text_field( wp_unslash( $_POST[ $var_name ] ) ); // Input var okay.
142
+ }
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Getter.
148
+ *
149
+ * @return string
150
+ */
151
+ public function get_action() {
152
+ return $this->action;
153
+ }
154
+
155
+ /**
156
+ * Getter.
157
+ *
158
+ * @return string
159
+ */
160
+ public function get_lang() {
161
+ return $this->lang;
162
+ }
163
+
164
+ /**
165
+ * Getter.
166
+ *
167
+ * @return bool
168
+ */
169
+ public function is_submit() {
170
+ return $this->is_submit;
171
+ }
172
+
173
+ /**
174
+ * Getter.
175
+ *
176
+ * @return bool
177
+ */
178
+ public function is_delete() {
179
+ return $this->is_delete;
180
+ }
181
+
182
+ /**
183
+ * Getter.
184
+ *
185
+ * @return string
186
+ */
187
+ public function get_wpglobus_language_code() {
188
+ return $this->wpglobus_language_code;
189
+ }
190
+
191
+ /**
192
+ * Getter.
193
+ *
194
+ * @return string
195
+ */
196
+ public function get_wpglobus_flags() {
197
+ return $this->wpglobus_flags;
198
+ }
199
+
200
+ /**
201
+ * Getter.
202
+ *
203
+ * @return string
204
+ */
205
+ public function get_wpglobus_language_name() {
206
+ return $this->wpglobus_language_name;
207
+ }
208
+
209
+ /**
210
+ * Getter.
211
+ *
212
+ * @return string
213
+ */
214
+ public function get_wpglobus_en_language_name() {
215
+ return $this->wpglobus_en_language_name;
216
+ }
217
+
218
+ /**
219
+ * Getter.
220
+ *
221
+ * @return string
222
+ */
223
+ public function get_wpglobus_locale() {
224
+ return $this->wpglobus_locale;
225
+ }
226
+
227
+ public static function url_language_add() {
228
+ $url = add_query_arg( array(
229
+ 'page' => WPGlobus::LANGUAGE_EDIT_PAGE,
230
+ 'action' => self::ACTION_ADD,
231
+ ), admin_url( 'admin.php' ) );
232
+
233
+ return wp_nonce_url( $url, self::NONCE_ACTION );
234
+ }
235
+
236
+ public static function url_language_edit( $language_code ) {
237
+ $url = add_query_arg( array(
238
+ 'page' => WPGlobus::LANGUAGE_EDIT_PAGE,
239
+ 'lang' => $language_code,
240
+ 'action' => self::ACTION_EDIT,
241
+ ), admin_url( 'admin.php' ) );
242
+
243
+ return wp_nonce_url( $url, self::NONCE_ACTION );
244
+ }
245
+
246
+ public static function url_language_delete( $language_code ) {
247
+ $url = add_query_arg( array(
248
+ 'page' => WPGlobus::LANGUAGE_EDIT_PAGE,
249
+ 'lang' => $language_code,
250
+ 'action' => self::ACTION_DELETE,
251
+ ), admin_url( 'admin.php' ) );
252
+
253
+ return wp_nonce_url( $url, self::NONCE_ACTION );
254
+ }
255
+ }
includes/admin/class-wpglobus-language-edit.php CHANGED
@@ -466,7 +466,7 @@ class WPGlobus_Language_Edit {
466
 
467
  <hr/>
468
  <span class="dashicons dashicons-admin-site"></span>
469
- <a href="<?php echo esc_url( admin_url( 'admin.php?page=wpglobus_options' ) ); ?>">
470
  <?php esc_html_e( 'Back to the WPGlobus Settings', 'wpglobus' ); ?>
471
  </a>
472
  </div>
466
 
467
  <hr/>
468
  <span class="dashicons dashicons-admin-site"></span>
469
+ <a href="<?php echo esc_url( WPGlobus_Admin_Page::url_settings() ); ?>">
470
  <?php esc_html_e( 'Back to the WPGlobus Settings', 'wpglobus' ); ?>
471
  </a>
472
  </div>
includes/admin/helpdesk/class-wpglobus-admin-helpdesk.php CHANGED
@@ -16,7 +16,7 @@ class WPGlobus_Admin_HelpDesk {
16
  * CSS class for the menu icon.
17
  * @var string
18
  */
19
- const ICON_CLASS = 'dashicons dashicons-before dashicons-format-chat';
20
 
21
  /**
22
  * Admin page title.
@@ -28,21 +28,12 @@ class WPGlobus_Admin_HelpDesk {
28
  * @var string
29
  */
30
  protected static $menu_title;
31
- /**
32
- * Admin menu tooltip.
33
- * @var string
34
- */
35
- protected static $menu_tooltip;
36
- /**
37
- * Admin page URL.
38
- * @var string
39
- */
40
- public static $admin_page_url;
41
 
42
  /**
43
  * Static "constructor".
44
  */
45
  public static function construct() {
 
46
  self::set_hooks();
47
  }
48
 
@@ -52,63 +43,31 @@ class WPGlobus_Admin_HelpDesk {
52
  public static function set_vars() {
53
  self::$page_title = __( 'WPGlobus Help Desk', 'wpglobus' );
54
  self::$menu_title = __( 'Help Desk', 'wpglobus' );
55
- self::$menu_tooltip = __( 'Contact WPGlobus Support', 'wpglobus' );
56
-
57
- self::$admin_page_url = admin_url( 'admin.php?page=' ) .
58
- WPGlobus::PAGE_WPGLOBUS_HELPDESK;
59
  }
60
 
61
  /**
62
  * Setup actions and filters.
63
  */
64
  protected static function set_hooks() {
65
- add_action( 'admin_init', array( __CLASS__, 'set_vars' ) );
66
- add_action( 'admin_menu', array( __CLASS__, 'add_menu' ) );
67
- add_action( 'admin_footer', array( __CLASS__, 'show_submenu' ), PHP_INT_MAX );
68
  }
69
 
70
  /**
71
- * Add a hidden admin menu item.
72
- * It will become visible in @see WPGlobus_Admin_HelpDesk::show_submenu
73
  */
74
  public static function add_menu() {
75
  add_submenu_page(
76
- null,
77
- '',
78
- '',
 
 
79
  'administrator',
80
  WPGlobus::PAGE_WPGLOBUS_HELPDESK,
81
  array( __CLASS__, 'helpdesk_page' )
82
  );
83
  }
84
 
85
- /**
86
- * Make the admin menu item visible.
87
- * This is a workaround because the WPGlobus options panel is made by ReduxFramework.
88
- */
89
- public static function show_submenu() {
90
- ?>
91
- <script>
92
- jQuery(function ($) {
93
- $('#toplevel_page_wpglobus_options')
94
- .find("ul")
95
- .prepend($("<li>")
96
- .append($("<a>")
97
- .attr({
98
- href: "<?php echo esc_url( self::$admin_page_url ); ?>",
99
- title: "<?php echo esc_js( self::$menu_tooltip ); ?>"
100
- })
101
- .html(' <?php echo esc_js( self::$menu_title ); ?>')
102
- .prepend($("<span>")
103
- .attr({"class": "<?php echo esc_js( self::ICON_CLASS ); ?>"})
104
- )
105
- )
106
- );
107
- });
108
- </script>
109
- <?php
110
- }
111
-
112
  /**
113
  * The admin page.
114
  */
16
  * CSS class for the menu icon.
17
  * @var string
18
  */
19
+ const ICON_CLASS = 'dashicons dashicons-before dashicons-phone';
20
 
21
  /**
22
  * Admin page title.
28
  * @var string
29
  */
30
  protected static $menu_title;
 
 
 
 
 
 
 
 
 
 
31
 
32
  /**
33
  * Static "constructor".
34
  */
35
  public static function construct() {
36
+ self::set_vars();
37
  self::set_hooks();
38
  }
39
 
43
  public static function set_vars() {
44
  self::$page_title = __( 'WPGlobus Help Desk', 'wpglobus' );
45
  self::$menu_title = __( 'Help Desk', 'wpglobus' );
 
 
 
 
46
  }
47
 
48
  /**
49
  * Setup actions and filters.
50
  */
51
  protected static function set_hooks() {
52
+ add_action( 'admin_menu', array( __CLASS__, 'add_menu' ), PHP_INT_MAX );
 
 
53
  }
54
 
55
  /**
56
+ * Add admin menu item.
 
57
  */
58
  public static function add_menu() {
59
  add_submenu_page(
60
+ WPGlobus::OPTIONS_PAGE_SLUG,
61
+ self::$page_title,
62
+ '<span class="' . esc_attr( self::ICON_CLASS )
63
+ . '" style="vertical-align:middle"></span> '
64
+ . self::$menu_title,
65
  'administrator',
66
  WPGlobus::PAGE_WPGLOBUS_HELPDESK,
67
  array( __CLASS__, 'helpdesk_page' )
68
  );
69
  }
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  /**
72
  * The admin page.
73
  */
includes/class-wpglobus-config.php CHANGED
@@ -367,24 +367,36 @@ class WPGlobus_Config {
367
  * @return void
368
  */
369
  public function on_load_textdomain() {
370
- // load_plugin_textdomain( 'wpglobus', false, basename( dirname( dirname( __FILE__ ) ) ) . '/languages' );
371
  self::load_mofile();
372
  }
373
 
374
  /**
375
  * Load .MO file from the plugin's `languages` folder.
376
- * Used instead of @see load_plugin_textdomain to ignore translation files from WordPress.org, which are incorrect.
377
  * To force loading from a different place, use the `load_textdomain_mofile` filter.
378
- * @since 1.9.6
379
  *
 
380
  */
381
  protected function load_mofile() {
382
  $domain = 'wpglobus';
383
- $locale = apply_filters( 'plugin_locale', is_admin() ? get_user_locale() : get_locale(), $domain );
384
 
385
- $mofile = WPGlobus::languages_path() . '/' . $domain . '-' . $locale . '.mo';
 
 
 
 
 
 
 
 
 
386
 
387
- return load_textdomain( $domain, $mofile );
 
 
 
 
 
388
  }
389
 
390
  /**
367
  * @return void
368
  */
369
  public function on_load_textdomain() {
 
370
  self::load_mofile();
371
  }
372
 
373
  /**
374
  * Load .MO file from the plugin's `languages` folder.
375
+ * Used instead of @see load_plugin_textdomain to ignore translation files from WordPress.org, which are outdated.
376
  * To force loading from a different place, use the `load_textdomain_mofile` filter.
 
377
  *
378
+ * @since 1.9.6
379
  */
380
  protected function load_mofile() {
381
  $domain = 'wpglobus';
 
382
 
383
+ /**
384
+ * Delete translations that could be loaded already from the main /languages/ folder.
385
+ *
386
+ * @global array $l10n
387
+ * @since 1.9.10
388
+ */
389
+ global $l10n;
390
+ if ( isset( $l10n[ $domain ] ) ) {
391
+ unset( $l10n[ $domain ] );
392
+ }
393
 
394
+ /**
395
+ * Load our translations.
396
+ */
397
+ $locale = apply_filters( 'plugin_locale', is_admin() ? get_user_locale() : get_locale(), $domain );
398
+ $mofile = WPGlobus::languages_path() . '/' . $domain . '-' . $locale . '.mo';
399
+ load_textdomain( $domain, $mofile );
400
  }
401
 
402
  /**
includes/class-wpglobus-post-types.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WPGlobus Post Types
4
+ *
5
+ * @package WPGlobus
6
+ * @since 1.9.10
7
+ */
8
+
9
+ /**
10
+ * Class WPGlobus_Post_Types
11
+ */
12
+ class WPGlobus_Post_Types {
13
+
14
+ /**
15
+ * Names of the CPTs that should not be visible in the WPGlobus options panel.
16
+ *
17
+ * @var string[]
18
+ */
19
+ protected static $hidden_types_main = array(
20
+ // Built-in.
21
+ 'attachment',
22
+ 'revision',
23
+ 'nav_menu_item',
24
+ 'custom_css',
25
+ 'customize_changeset',
26
+ 'oembed_cache',
27
+ // Custom types that do not need WPGlobus' tabbed interface or those that we cannot handle.
28
+ 'scheduled-action',
29
+ 'wp-types-group',
30
+ 'wp-types-user-group',
31
+ 'wp-types-term-group',
32
+ 'wpcf7_contact_form',
33
+ 'tablepress_table',
34
+ // ACF: free and pro.
35
+ 'acf',
36
+ 'acf-field',
37
+ 'acf-field-group',
38
+ );
39
+
40
+ /**
41
+ * WooCommerce types: we either force-enable them in WPG-WC or we do not need to handle them.
42
+ * Will hide them only if WooCommerce is active, to prevent potential conflict with other plugins
43
+ * that may use the same ("product") type(s).
44
+ *
45
+ * @var string[]
46
+ */
47
+ protected static $hidden_types_wc = array(
48
+ 'product',
49
+ 'product_variation',
50
+ 'shop_subscription',
51
+ 'shop_coupon',
52
+ 'shop_order',
53
+ 'shop_order_refund',
54
+ );
55
+
56
+ /**
57
+ * Get hidden post types.
58
+ *
59
+ * @return string[]
60
+ */
61
+ public static function hidden_types() {
62
+ $hidden_types = self::$hidden_types_main;
63
+
64
+ if ( class_exists( 'WooCommerce', false ) ) {
65
+ $hidden_types = array_merge( $hidden_types, self::$hidden_types_wc );
66
+ }
67
+
68
+ return $hidden_types;
69
+ }
70
+ }
includes/class-wpglobus.php CHANGED
@@ -189,15 +189,8 @@ class WPGlobus {
189
  'on_admin_init'
190
  ) );
191
 
192
- /**
193
- * @todo $WPGlobus_Options is unused. Remove it.
194
- */
195
- global $WPGlobus_Options;
196
-
197
  global $pagenow;
198
 
199
- $config = WPGlobus::Config();
200
-
201
  /**
202
  * Init array of supported plugins
203
  */
@@ -251,7 +244,7 @@ class WPGlobus {
251
  */
252
  $this->disabled_entities[] = 'product_variation';
253
  $this->disabled_entities[] = 'shop_order_refund';
254
- $this->disabled_entities[] = 'shop_webhook';
255
 
256
  }
257
 
@@ -288,7 +281,7 @@ class WPGlobus {
288
  /**
289
  * Add disabled post types from option
290
  */
291
- $option = get_option( 'wpglobus_option' );
292
  $options_post_types = empty( $option['post_type'] ) ? array() : $option['post_type'];
293
  foreach ( $options_post_types as $post_type => $value ) {
294
  if ( $value != '1' ) {
@@ -296,6 +289,8 @@ class WPGlobus {
296
  }
297
  }
298
 
 
 
299
  /**
300
  * Set disabled entities into config
301
  * @todo maybe move code to Class WPGlobus_Config
@@ -309,8 +304,7 @@ class WPGlobus {
309
 
310
 
311
  /**
312
- * NOTE: do not check for !DOING_AJAX here. Redux uses AJAX, for example, for disabling tracking.
313
- * So, we need to load Redux on AJAX requests, too
314
  */
315
  if ( is_admin() ) {
316
 
@@ -1151,7 +1145,7 @@ class WPGlobus {
1151
 
1152
  }
1153
 
1154
- if ( self::LANGUAGE_EDIT_PAGE === $page ) {
1155
 
1156
  /**
1157
  * Using the same 'select2-js' ID as Redux Plugin does, to avoid duplicate enqueueing
@@ -1707,6 +1701,7 @@ class WPGlobus {
1707
  array(
1708
  'wpglobus_version' => WPGLOBUS_VERSION,
1709
  'pro' => $this->vendors_scripts['ACFPRO'] ? true : false,
 
1710
  'disabledFields' => $disabled_fields
1711
  )
1712
  );
189
  'on_admin_init'
190
  ) );
191
 
 
 
 
 
 
192
  global $pagenow;
193
 
 
 
194
  /**
195
  * Init array of supported plugins
196
  */
244
  */
245
  $this->disabled_entities[] = 'product_variation';
246
  $this->disabled_entities[] = 'shop_order_refund';
247
+ $this->disabled_entities[] = 'shop_webhook'; // Obsolete in WC3.
248
 
249
  }
250
 
281
  /**
282
  * Add disabled post types from option
283
  */
284
+ $option = get_option( WPGlobus::Config()->option );
285
  $options_post_types = empty( $option['post_type'] ) ? array() : $option['post_type'];
286
  foreach ( $options_post_types as $post_type => $value ) {
287
  if ( $value != '1' ) {
289
  }
290
  }
291
 
292
+ $this->disabled_entities = array_unique( $this->disabled_entities );
293
+
294
  /**
295
  * Set disabled entities into config
296
  * @todo maybe move code to Class WPGlobus_Config
304
 
305
 
306
  /**
307
+ * NOTE: do not check for !DOING_AJAX here.
 
308
  */
309
  if ( is_admin() ) {
310
 
1145
 
1146
  }
1147
 
1148
+ if ( in_array( $page, array( self::LANGUAGE_EDIT_PAGE, self::OPTIONS_PAGE_SLUG ) ) ) {
1149
 
1150
  /**
1151
  * Using the same 'select2-js' ID as Redux Plugin does, to avoid duplicate enqueueing
1701
  array(
1702
  'wpglobus_version' => WPGLOBUS_VERSION,
1703
  'pro' => $this->vendors_scripts['ACFPRO'] ? true : false,
1704
+ 'fields' => array(),
1705
  'disabledFields' => $disabled_fields
1706
  )
1707
  );
includes/css/images/wpglobus-logo.jpg ADDED
Binary file
includes/css/wpglobus-options.css ADDED
@@ -0,0 +1,314 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @supports (display:grid) {
2
+ #wpglobus-options-old-browser-warning {
3
+ display: none;
4
+ }
5
+ }
6
+ #wpglobus-options-intro-text {
7
+ display: grid;
8
+ grid-template-columns: 100%;
9
+ place-items: center;
10
+ grid-gap: 0;
11
+ background-color: #d3e4f4;
12
+ }
13
+ @media screen and (min-width: 699px) {
14
+ #wpglobus-options-intro-text {
15
+ grid-template-columns: 20% 40% 40%;
16
+ }
17
+ }
18
+ #wpglobus-options-intro-text .grid__item {
19
+ padding: initial;
20
+ max-width: none;
21
+ }
22
+ /** top banners **/
23
+ .wpg-bnr {
24
+ display: grid;
25
+ grid-template-columns: 100%;
26
+ place-items: center;
27
+ }
28
+ @media screen and (min-width: 1499px) {
29
+ .wpg-bnr {
30
+ grid-template-columns: 30% 70%;
31
+ }
32
+ }
33
+ .wpg-bnr .wpg-bnr__item {
34
+ max-width: none;
35
+ }
36
+ #wpglobus-options-intro-text .wpg-bnr-title {
37
+ padding: 20px 0;
38
+ }
39
+ .wpg-bnr .wpg-img-block {
40
+ height: 150px;
41
+ width: 150px;
42
+ background-color: #fff;
43
+ }
44
+ .wpg-bnr .wpg-text-block {
45
+ width: 40%;
46
+ padding: 10px;
47
+ }
48
+ @media screen and (min-width: 699px) {
49
+ .wpg-bnr .wpg-text-block {
50
+ width: 95%;
51
+ }
52
+ }
53
+ /**
54
+ * Main options wrapper.
55
+ */
56
+ .wpglobus-options-wrap {
57
+ display: grid;
58
+ grid-template-columns: 15% 85%;
59
+ grid-gap: 0;
60
+ background-color: #f3f3f3;
61
+ }
62
+ @media screen and (max-width: 750px) {
63
+ .wpglobus-options-wrap {
64
+ grid-template-columns: 7% 93%;
65
+ }
66
+ }
67
+ /** options tab hidden by default **/
68
+ .wpglobus-options-tab {
69
+ display: none;
70
+ }
71
+ /**
72
+ * Sidebar menu.
73
+ */
74
+ .wpglobus-options-sidebar li a {
75
+ display: block;
76
+ padding: 10px 4px 10px 14px;
77
+ background: transparent;
78
+ border-width: 1px 0;
79
+ border-style: solid;
80
+ border-bottom-color: #E7E7E7;
81
+ border-top-color: #F9F9F9;
82
+ opacity: 0.7;
83
+ color: #555;
84
+ font-weight: bold;
85
+ text-decoration: none;
86
+ -webkit-transition: none;
87
+ transition: none;
88
+ }
89
+ @media screen and (max-width: 750px) {
90
+ .wpglobus-options-sidebar li a {
91
+ padding: 10px 0;
92
+ text-align: center;
93
+ }
94
+ }
95
+ .wpglobus-options-sidebar li a:hover {
96
+ color: #00f !important;
97
+ }
98
+ .wpglobus-options-sidebar .wpglobus-tab-link-active {
99
+ background-color: #fcfcfc;
100
+ }
101
+ @media screen and (max-width: 750px) {
102
+ .wpglobus-options-sidebar .group_title {
103
+ display: none;
104
+ }
105
+ }
106
+ /** options main block **/
107
+ .wpglobus-options-main {
108
+ padding: 0 10px 10px;
109
+ background-color: #fcfcfc;
110
+ }
111
+ .wpglobus-options-main h2 {
112
+ padding-left: 20px;
113
+ }
114
+ /** section: Language table **/
115
+ .wpglobus-options-main #wpglobus_add_language.button-primary {
116
+ margin: 15px 15px 0;
117
+ }
118
+ .wpglobus-options-main .tablenav .one-page .displaying-num {
119
+ margin-right: 15px;
120
+ }
121
+ /** All field types **/
122
+ .wpglobus-options-main .wpglobus-options-field {
123
+ border: 1px solid #a9b6c2;
124
+ border-radius: 0;
125
+ margin: 10px 0;
126
+ }
127
+ .wpglobus-options-main .wpglobus-options-field .title {
128
+ margin: 0;
129
+ padding: 1em 2em 1em 0;
130
+ font-size: 14px;
131
+ font-weight: 600;
132
+ }
133
+ .wpglobus-options-main .wpglobus-options-field .grid__item .title {
134
+ padding: 1em 1em 0.5em 1.5em;
135
+ }
136
+ .wpglobus-options-main .wpglobus-options-field .subtitle {
137
+ padding: 0 2em 0 1.5em;
138
+ font-size: 13px;
139
+ font-weight: 400;
140
+ }
141
+ .wpglobus-options-main .wpglobus-options-field .description {
142
+ font-size: 13px;
143
+ font-style: normal;
144
+ }
145
+ /** Field type: 'wpglobus_info' **/
146
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_info {
147
+ min-height: 20px;
148
+ padding: 8px 19px;
149
+ color: #000;
150
+ background-color: #d3e4f4;
151
+ }
152
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_info.info {
153
+ background-color: #d3e4f4;
154
+ border-color: #a9b6c2;
155
+ }
156
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_info.normal {
157
+ background-color: #eeeeee;
158
+ border-color: #cccccc;
159
+ }
160
+ /** Field type: 'wpglobus_sortable' **/
161
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_sortable {
162
+ display: grid;
163
+ grid-template-columns: 30% 70%;
164
+ align-items: center;
165
+ /* place-items: center; */
166
+ grid-gap: 0;
167
+ background-color: #d3e4f4;
168
+ }
169
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_sortable .dashicons-move {
170
+ cursor: move;
171
+ }
172
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_sortable .ui-state-highlight {
173
+ height: 2em;
174
+ line-height: 1.5em;
175
+ background-color: #f1f1f1;
176
+ width: 200px;
177
+ border-radius: 5px;
178
+ }
179
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_sortable .grid__item {
180
+ padding: initial;
181
+ max-width: none;
182
+ }
183
+ /** Field type: 'wpglobus_select' **/
184
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_select {
185
+ display: grid;
186
+ grid-template-columns: 30% 70%;
187
+ align-items: center;
188
+ grid-gap: 0;
189
+ background-color: #d3e4f4;
190
+ padding: 20px 0 20px;
191
+ }
192
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_select .grid__item {
193
+ padding: initial;
194
+ max-width: none;
195
+ }
196
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_select .subtitle {
197
+ margin: 1em 0;
198
+ }
199
+ /** Field type: 'wpglobus_ace_editor' **/
200
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_ace_editor {
201
+ display: grid;
202
+ grid-template-columns: 20% 80%;
203
+ align-items: center;
204
+ grid-gap: 0;
205
+ background-color: #d3e4f4;
206
+ padding: 20px 0 20px;
207
+ }
208
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_ace_editor .grid__item {
209
+ padding: initial;
210
+ max-width: none;
211
+ }
212
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_ace_editor .subtitle {
213
+ margin: 1em 0;
214
+ }
215
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_ace_editor .ace_editor {
216
+ margin: 0 1em 0 0;
217
+ }
218
+ /** Field type: 'wpglobus_checkbox' **/
219
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_checkbox {
220
+ display: grid;
221
+ grid-template-columns: 30% 70%;
222
+ align-items: center;
223
+ grid-gap: 0;
224
+ background-color: #d3e4f4;
225
+ padding: 20px 0 20px;
226
+ }
227
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_checkbox .grid__item {
228
+ padding: initial;
229
+ max-width: none;
230
+ }
231
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_checkbox .subtitle {
232
+ margin: 1em 0;
233
+ }
234
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_checkbox .checkbox {
235
+ margin: 0 1em 0 0;
236
+ }
237
+ /**
238
+ * Colors
239
+ */
240
+ .wpglobus-options-menu li i,
241
+ .wpglobus-options-menu li .group_title {
242
+ color: #1445b8;
243
+ }
244
+ /*
245
+ .wpglobus-options-menu li.wpglobus-tab-external i,
246
+ .wpglobus-options-menu li.wpglobus-tab-external .group_title {
247
+ color: hsl(270, 70%, 30%);
248
+ }
249
+ */
250
+ #wpglobus-tab-link-helpdesk i,
251
+ #wpglobus-tab-link-helpdesk .group_title {
252
+ color: #178217;
253
+ }
254
+ #wpglobus-tab-link-helpdesk .group_title {
255
+ border-bottom: 1px dotted;
256
+ }
257
+ /*
258
+ #wpglobus-tab-link-languages i,
259
+ #wpglobus-tab-link-languages .group_title {
260
+ color: hsl(0, 100%, 25%);
261
+ }
262
+
263
+ #wpglobus-tab-link-languages .group_title {
264
+ border-bottom: 1px dotted;
265
+ }
266
+ */
267
+ #wpglobus-tab-link-uninstall i,
268
+ #wpglobus-tab-link-uninstall .group_title {
269
+ color: #79867d;
270
+ }
271
+ #wpglobus-tab-link-recommendations i {
272
+ color: #800000;
273
+ animation: filter-animation-blink 8s infinite;
274
+ }
275
+ @keyframes filter-animation-blink {
276
+ 0% {
277
+ filter: opacity(0.1);
278
+ }
279
+ 50% {
280
+ filter: opacity(1);
281
+ }
282
+ 100% {
283
+ filter: opacity(0.1);
284
+ }
285
+ }
286
+ /**
287
+ * Section-tab: recommendations.
288
+ */
289
+ .wpglobus-recommend-container {
290
+ display: grid;
291
+ grid-template-columns: 20% 80%;
292
+ grid-gap: 2em;
293
+ }
294
+ .wpglobus-recommend-container .grid__item {
295
+ padding: initial;
296
+ max-width: none;
297
+ }
298
+ .wpglobus-recommend-container .wpglobus-recommend-logo img {
299
+ background-color: white;
300
+ width: 100%;
301
+ max-width: 200px;
302
+ border: 1px solid #a9b6c2;
303
+ }
304
+ .wpglobus-recommend-container h3 {
305
+ margin-top: 0;
306
+ color: #0070a8;
307
+ }
308
+ @media screen and (max-width: 500px) {
309
+ .wpglobus-recommend-container {
310
+ grid-template-columns: 100%;
311
+ place-items: center;
312
+ grid-gap: 0;
313
+ }
314
+ }
includes/css/wpglobus-options.less ADDED
@@ -0,0 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @supports (display:grid) {
2
+ #wpglobus-options-old-browser-warning {
3
+ display: none;
4
+ }
5
+ }
6
+
7
+ .wpglobus-options-container {
8
+ }
9
+
10
+ #wpglobus-options-intro-text {
11
+ display: grid;
12
+ grid-template-columns: 100%;
13
+ place-items: center;
14
+ grid-gap: 0;
15
+ background-color: #d3e4f4;
16
+ }
17
+
18
+ @media screen and (min-width: 699px) {
19
+ #wpglobus-options-intro-text {
20
+ grid-template-columns: 20% 40% 40%;
21
+ }
22
+ }
23
+
24
+ #wpglobus-options-intro-text .grid__item {
25
+ padding: initial;
26
+ max-width: none;
27
+ }
28
+
29
+ /** top banners **/
30
+ .wpg-bnr {
31
+ display: grid;
32
+ grid-template-columns: 100%;
33
+ place-items: center;
34
+ }
35
+
36
+ @media screen and (min-width: 1499px) {
37
+ .wpg-bnr {
38
+ grid-template-columns: 30% 70%;
39
+ }
40
+ }
41
+
42
+ .wpg-bnr .wpg-bnr__item {
43
+ max-width: none;
44
+ }
45
+
46
+ #wpglobus-options-intro-text .wpg-bnr-title {
47
+ padding: 20px 0;
48
+ }
49
+
50
+ .wpg-bnr .wpg-img-block {
51
+ height: 150px;
52
+ width: 150px;
53
+ background-color: #fff;
54
+ }
55
+
56
+ .wpg-bnr .wpg-text-block {
57
+ width: 40%;
58
+ padding: 10px;
59
+ }
60
+
61
+ @media screen and (min-width: 699px) {
62
+ .wpg-bnr .wpg-text-block {
63
+ width: 95%;
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Main options wrapper.
69
+ */
70
+ .wpglobus-options-wrap {
71
+ display: grid;
72
+ grid-template-columns: 15% 85%;
73
+ grid-gap: 0;
74
+ background-color: rgb(243, 243, 243);
75
+ }
76
+
77
+ @media screen and (max-width: 750px) {
78
+ .wpglobus-options-wrap {
79
+ grid-template-columns: 7% 93%;
80
+ }
81
+ }
82
+
83
+ /** options tab hidden by default **/
84
+ .wpglobus-options-tab {
85
+ display: none;
86
+ }
87
+
88
+ /**
89
+ * Sidebar menu.
90
+ */
91
+ .wpglobus-options-sidebar li a {
92
+ display: block;
93
+ padding: 10px 4px 10px 14px;
94
+ background: transparent;
95
+ border-width: 1px 0;
96
+ border-style: solid;
97
+ border-bottom-color: #E7E7E7;
98
+ border-top-color: #F9F9F9;
99
+ opacity: 0.7;
100
+ color: #555;
101
+ font-weight: bold;
102
+ text-decoration: none;
103
+ -webkit-transition: none;
104
+ transition: none;
105
+ }
106
+
107
+ @media screen and (max-width: 750px) {
108
+ .wpglobus-options-sidebar li a {
109
+ padding: 10px 0;
110
+ text-align: center;
111
+ }
112
+ }
113
+
114
+ .wpglobus-options-sidebar li a:hover {
115
+ color: #00f !important;
116
+ }
117
+
118
+ .wpglobus-options-sidebar .wpglobus-tab-link-active {
119
+ background-color: rgb(252, 252, 252);
120
+ }
121
+
122
+ @media screen and (max-width: 750px) {
123
+ .wpglobus-options-sidebar .group_title {
124
+ display: none;
125
+ }
126
+ }
127
+
128
+ /** options main block **/
129
+ .wpglobus-options-main {
130
+ padding: 0 10px 10px;
131
+ background-color: rgb(252, 252, 252);
132
+ }
133
+
134
+ .wpglobus-options-main h2 {
135
+ padding-left: 20px;
136
+ }
137
+
138
+ /** section: Language table **/
139
+ .wpglobus-options-main #wpglobus_add_language.button-primary {
140
+ margin: 15px 15px 0;
141
+ }
142
+
143
+ .wpglobus-options-main .tablenav .one-page .displaying-num {
144
+ margin-right: 15px;
145
+ }
146
+
147
+ /** All field types **/
148
+ .wpglobus-options-main .wpglobus-options-field {
149
+ border: 1px solid #a9b6c2;
150
+ border-radius: 0;
151
+ margin: 10px 0;
152
+ }
153
+
154
+ .wpglobus-options-main .wpglobus-options-field .title {
155
+ margin: 0;
156
+ padding: 1em 2em 1em 0;
157
+ font-size: 14px;
158
+ font-weight: 600;
159
+ }
160
+
161
+ .wpglobus-options-main .wpglobus-options-field .grid__item .title {
162
+ padding: 1em 1em 0.5em 1.5em;
163
+ }
164
+
165
+ .wpglobus-options-main .wpglobus-options-field .subtitle {
166
+ padding: 0 2em 0 1.5em;
167
+ font-size: 13px;
168
+ font-weight: 400;
169
+ }
170
+
171
+ .wpglobus-options-main .wpglobus-options-field .description {
172
+ font-size: 13px;
173
+ font-style: normal;
174
+ }
175
+
176
+ /** Field type: 'wpglobus_info' **/
177
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_info {
178
+ min-height: 20px;
179
+ padding: 8px 19px;
180
+ color: #000;
181
+ background-color: #d3e4f4;
182
+
183
+ }
184
+
185
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_info.info {
186
+ background-color: #d3e4f4;
187
+ border-color: #a9b6c2;
188
+ }
189
+
190
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_info.normal {
191
+ background-color: #eeeeee;
192
+ border-color: #cccccc;
193
+ }
194
+
195
+ /** Field type: 'wpglobus_sortable' **/
196
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_sortable {
197
+ display: grid;
198
+ grid-template-columns: 30% 70%;
199
+ align-items: center;
200
+ /* place-items: center; */
201
+ grid-gap: 0;
202
+ background-color: #d3e4f4;
203
+ }
204
+
205
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_sortable .dashicons-move {
206
+ cursor: move;
207
+ }
208
+
209
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_sortable .ui-state-highlight {
210
+ height: 2em;
211
+ line-height: 1.5em;
212
+ background-color: #f1f1f1;
213
+ width: 200px;
214
+ border-radius: 5px;
215
+ }
216
+
217
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_sortable .grid__item {
218
+ padding: initial;
219
+ max-width: none;
220
+ }
221
+
222
+ /** Field type: 'wpglobus_select' **/
223
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_select {
224
+ display: grid;
225
+ grid-template-columns: 30% 70%;
226
+ align-items: center;
227
+ grid-gap: 0;
228
+ background-color: #d3e4f4;
229
+ padding: 20px 0 20px;
230
+ }
231
+
232
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_select .grid__item {
233
+ padding: initial;
234
+ max-width: none;
235
+ }
236
+
237
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_select .subtitle {
238
+ margin: 1em 0;
239
+ }
240
+
241
+ /** Field type: 'wpglobus_ace_editor' **/
242
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_ace_editor {
243
+ display: grid;
244
+ grid-template-columns: 20% 80%;
245
+ align-items: center;
246
+ grid-gap: 0;
247
+ background-color: #d3e4f4;
248
+ padding: 20px 0 20px;
249
+ }
250
+
251
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_ace_editor .grid__item {
252
+ padding: initial;
253
+ max-width: none;
254
+ }
255
+
256
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_ace_editor .subtitle {
257
+ margin: 1em 0;
258
+ }
259
+
260
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_ace_editor .ace_editor {
261
+ margin: 0 1em 0 0;
262
+ }
263
+
264
+ /** Field type: 'wpglobus_checkbox' **/
265
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_checkbox {
266
+ display: grid;
267
+ grid-template-columns: 30% 70%;
268
+ align-items: center;
269
+ grid-gap: 0;
270
+ background-color: #d3e4f4;
271
+ padding: 20px 0 20px;
272
+ }
273
+
274
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_checkbox .grid__item {
275
+ padding: initial;
276
+ max-width: none;
277
+ }
278
+
279
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_checkbox .subtitle {
280
+ margin: 1em 0;
281
+ }
282
+
283
+ .wpglobus-options-main .wpglobus-options-field-wpglobus_checkbox .checkbox {
284
+ margin: 0 1em 0 0;
285
+ }
286
+
287
+ /**
288
+ * Colors
289
+ */
290
+
291
+ .wpglobus-options-menu li i,
292
+ .wpglobus-options-menu li .group_title {
293
+ color: hsl(222, 80%, 40%);
294
+ }
295
+
296
+ /*
297
+ .wpglobus-options-menu li.wpglobus-tab-external i,
298
+ .wpglobus-options-menu li.wpglobus-tab-external .group_title {
299
+ color: hsl(270, 70%, 30%);
300
+ }
301
+ */
302
+
303
+ #wpglobus-tab-link-helpdesk i,
304
+ #wpglobus-tab-link-helpdesk .group_title {
305
+ color: hsl(120, 70%, 30%);
306
+ }
307
+
308
+ #wpglobus-tab-link-helpdesk .group_title {
309
+ border-bottom: 1px dotted;
310
+ }
311
+
312
+ /*
313
+ #wpglobus-tab-link-languages i,
314
+ #wpglobus-tab-link-languages .group_title {
315
+ color: hsl(0, 100%, 25%);
316
+ }
317
+
318
+ #wpglobus-tab-link-languages .group_title {
319
+ border-bottom: 1px dotted;
320
+ }
321
+ */
322
+
323
+ #wpglobus-tab-link-uninstall i,
324
+ #wpglobus-tab-link-uninstall .group_title {
325
+ color: hsl(140, 5%, 50%);
326
+ }
327
+
328
+ #wpglobus-tab-link-recommendations i {
329
+ color: hsl(0, 100%, 25%);
330
+ animation: filter-animation-blink 8s infinite;
331
+ }
332
+
333
+ @keyframes filter-animation-blink {
334
+ 0% {
335
+ filter: opacity(.1);
336
+ }
337
+
338
+ 50% {
339
+ filter: opacity(1);
340
+ }
341
+
342
+ 100% {
343
+ filter: opacity(.1);
344
+ }
345
+ }
346
+
347
+ /**
348
+ * Section-tab: recommendations.
349
+ */
350
+ .wpglobus-recommend-container {
351
+ display: grid;
352
+ grid-template-columns: 20% 80%;
353
+ grid-gap: 2em;
354
+ }
355
+
356
+ .wpglobus-recommend-container .grid__item {
357
+ padding: initial;
358
+ max-width: none;
359
+ }
360
+
361
+ .wpglobus-recommend-container .wpglobus-recommend-logo img {
362
+ background-color: white;
363
+ width: 100%;
364
+ max-width: 200px;
365
+ border: 1px solid #a9b6c2;
366
+ }
367
+
368
+ .wpglobus-recommend-container h3 {
369
+ margin-top: 0;
370
+ color: hsl(200, 100%, 33%);
371
+ }
372
+
373
+ @media screen and (max-width: 500px) {
374
+ .wpglobus-recommend-container {
375
+ grid-template-columns: 100%;
376
+ place-items: center;
377
+ grid-gap: 0;
378
+ }
379
+ }
includes/css/wpglobus-options.min.css ADDED
@@ -0,0 +1 @@
 
1
+ @supports (display:grid){#wpglobus-options-old-browser-warning{display:none}}#wpglobus-options-intro-text{display:grid;grid-template-columns:100%;place-items:center;grid-gap:0;background-color:#d3e4f4}@media screen and (min-width:699px){#wpglobus-options-intro-text{grid-template-columns:20% 40% 40%}}#wpglobus-options-intro-text .grid__item{padding:initial;max-width:none}.wpg-bnr{display:grid;grid-template-columns:100%;place-items:center}@media screen and (min-width:1499px){.wpg-bnr{grid-template-columns:30% 70%}}.wpg-bnr .wpg-bnr__item{max-width:none}#wpglobus-options-intro-text .wpg-bnr-title{padding:20px 0}.wpg-bnr .wpg-img-block{height:150px;width:150px;background-color:#fff}.wpg-bnr .wpg-text-block{width:40%;padding:10px}@media screen and (min-width:699px){.wpg-bnr .wpg-text-block{width:95%}}.wpglobus-options-wrap{display:grid;grid-template-columns:15% 85%;grid-gap:0;background-color:#f3f3f3}@media screen and (max-width:750px){.wpglobus-options-wrap{grid-template-columns:7% 93%}}.wpglobus-options-tab{display:none}.wpglobus-options-sidebar li a{display:block;padding:10px 4px 10px 14px;background:0 0;border-width:1px 0;border-style:solid;border-bottom-color:#e7e7e7;border-top-color:#f9f9f9;opacity:.7;color:#555;font-weight:700;text-decoration:none;-webkit-transition:none;transition:none}@media screen and (max-width:750px){.wpglobus-options-sidebar li a{padding:10px 0;text-align:center}}.wpglobus-options-sidebar li a:hover{color:#00f!important}.wpglobus-options-sidebar .wpglobus-tab-link-active{background-color:#fcfcfc}@media screen and (max-width:750px){.wpglobus-options-sidebar .group_title{display:none}}.wpglobus-options-main{padding:0 10px 10px;background-color:#fcfcfc}.wpglobus-options-main h2{padding-left:20px}.wpglobus-options-main #wpglobus_add_language.button-primary{margin:15px 15px 0}.wpglobus-options-main .tablenav .one-page .displaying-num{margin-right:15px}.wpglobus-options-main .wpglobus-options-field{border:1px solid #a9b6c2;border-radius:0;margin:10px 0}.wpglobus-options-main .wpglobus-options-field .title{margin:0;padding:1em 2em 1em 0;font-size:14px;font-weight:600}.wpglobus-options-main .wpglobus-options-field .grid__item .title{padding:1em 1em .5em 1.5em}.wpglobus-options-main .wpglobus-options-field .subtitle{padding:0 2em 0 1.5em;font-size:13px;font-weight:400}.wpglobus-options-main .wpglobus-options-field .description{font-size:13px;font-style:normal}.wpglobus-options-main .wpglobus-options-field-wpglobus_info{min-height:20px;padding:8px 19px;color:#000;background-color:#d3e4f4}.wpglobus-options-main .wpglobus-options-field-wpglobus_info.info{background-color:#d3e4f4;border-color:#a9b6c2}.wpglobus-options-main .wpglobus-options-field-wpglobus_info.normal{background-color:#eee;border-color:#ccc}.wpglobus-options-main .wpglobus-options-field-wpglobus_sortable{display:grid;grid-template-columns:30% 70%;align-items:center;grid-gap:0;background-color:#d3e4f4}.wpglobus-options-main .wpglobus-options-field-wpglobus_sortable .dashicons-move{cursor:move}.wpglobus-options-main .wpglobus-options-field-wpglobus_sortable .ui-state-highlight{height:2em;line-height:1.5em;background-color:#f1f1f1;width:200px;border-radius:5px}.wpglobus-options-main .wpglobus-options-field-wpglobus_sortable .grid__item{padding:initial;max-width:none}.wpglobus-options-main .wpglobus-options-field-wpglobus_select{display:grid;grid-template-columns:30% 70%;align-items:center;grid-gap:0;background-color:#d3e4f4;padding:20px 0 20px}.wpglobus-options-main .wpglobus-options-field-wpglobus_select .grid__item{padding:initial;max-width:none}.wpglobus-options-main .wpglobus-options-field-wpglobus_select .subtitle{margin:1em 0}.wpglobus-options-main .wpglobus-options-field-wpglobus_ace_editor{display:grid;grid-template-columns:20% 80%;align-items:center;grid-gap:0;background-color:#d3e4f4;padding:20px 0 20px}.wpglobus-options-main .wpglobus-options-field-wpglobus_ace_editor .grid__item{padding:initial;max-width:none}.wpglobus-options-main .wpglobus-options-field-wpglobus_ace_editor .subtitle{margin:1em 0}.wpglobus-options-main .wpglobus-options-field-wpglobus_ace_editor .ace_editor{margin:0 1em 0 0}.wpglobus-options-main .wpglobus-options-field-wpglobus_checkbox{display:grid;grid-template-columns:30% 70%;align-items:center;grid-gap:0;background-color:#d3e4f4;padding:20px 0 20px}.wpglobus-options-main .wpglobus-options-field-wpglobus_checkbox .grid__item{padding:initial;max-width:none}.wpglobus-options-main .wpglobus-options-field-wpglobus_checkbox .subtitle{margin:1em 0}.wpglobus-options-main .wpglobus-options-field-wpglobus_checkbox .checkbox{margin:0 1em 0 0}.wpglobus-options-menu li .group_title,.wpglobus-options-menu li i{color:#1445b8}#wpglobus-tab-link-helpdesk .group_title,#wpglobus-tab-link-helpdesk i{color:#178217}#wpglobus-tab-link-helpdesk .group_title{border-bottom:1px dotted}#wpglobus-tab-link-uninstall .group_title,#wpglobus-tab-link-uninstall i{color:#79867d}#wpglobus-tab-link-recommendations i{color:maroon;animation:filter-animation-blink 8s infinite}@keyframes filter-animation-blink{0%{filter:opacity(.1)}50%{filter:opacity(1)}100%{filter:opacity(.1)}}.wpglobus-recommend-container{display:grid;grid-template-columns:20% 80%;grid-gap:2em}.wpglobus-recommend-container .grid__item{padding:initial;max-width:none}.wpglobus-recommend-container .wpglobus-recommend-logo img{background-color:#fff;width:100%;max-width:200px;border:1px solid #a9b6c2}.wpglobus-recommend-container h3{margin-top:0;color:#0070a8}@media screen and (max-width:500px){.wpglobus-recommend-container{grid-template-columns:100%;place-items:center;grid-gap:0}}
includes/js/wpglobus-admin-47.js CHANGED
@@ -1,1649 +1,1649 @@
1
- /**
2
- * WPGlobus Administration Core, Dialog, Admin
3
- * Interface JS functions
4
- *
5
- * @since 1.7.0
6
- *
7
- * @package WPGlobus
8
- * @subpackage Administration
9
- */
10
- /*jslint browser: true*/
11
- /*global jQuery, console, WPGlobusCore, WPGlobusDialogApp, WPGlobusAdmin, inlineEditPost */
12
-
13
- var WPGlobusCore;
14
-
15
- (function($) {
16
- var api;
17
- api = WPGlobusCore = {
18
- strpos: function( haystack, needle, offset){
19
- haystack = "" + haystack;
20
- var i = haystack.indexOf( needle, offset );
21
- return i >= 0 ? i : false;
22
- },
23
-
24
- TextFilter: function(text, language, return_in){
25
- if ( typeof text == 'undefined' || '' === text ) { return text; }
26
-
27
- var pos_start, pos_end, possible_delimiters = [], is_local_text_found = false;;
28
-
29
- language = '' == language ? 'en' : language;
30
- return_in = typeof return_in == 'undefined' || '' == return_in ? 'RETURN_IN_DEFAULT_LANGUAGE' : return_in;
31
-
32
- possible_delimiters[0] = [];
33
- possible_delimiters[0]['start'] = WPGlobusCoreData.locale_tag_start.replace('%s', language);
34
- possible_delimiters[0]['end'] = WPGlobusCoreData.locale_tag_end;
35
-
36
- possible_delimiters[1] = [];
37
- possible_delimiters[1]['start'] = '<!--:'+language+'-->';
38
- possible_delimiters[1]['end'] = '<!--:-->';
39
-
40
- possible_delimiters[2] = [];
41
- possible_delimiters[2]['start'] = '[:'+language+']';
42
- possible_delimiters[2]['end'] = '[:';
43
-
44
-
45
-
46
- for (var i = 0; i < 3; i++) {
47
-
48
- pos_start = api.strpos( text, possible_delimiters[i]['start'] );
49
- if ( pos_start === false ) {
50
- continue;
51
- }
52
-
53
- pos_start = pos_start + possible_delimiters[i]['start'].length;
54
-
55
- pos_end = api.strpos( text, possible_delimiters[i]['end'], pos_start );
56
-
57
- if ( pos_end === false ) {
58
- text = text.substr( pos_start );
59
- } else {
60
- text = text.substr( pos_start, pos_end - pos_start );
61
- }
62
-
63
- is_local_text_found = true;
64
- break;
65
-
66
- }
67
-
68
- if ( ! is_local_text_found ) {
69
- if ( return_in == 'RETURN_EMPTY' ) {
70
- if ( language == WPGlobusCoreData.default_language && ! /(\{:|\[:|<!--:)[a-z]{2}/.test(text) ) {
71
- /** do nothing */
72
- } else {
73
- text = '';
74
- }
75
- } else {
76
- /**
77
- * Try RETURN_IN_DEFAULT_LANGUAGE.
78
- */
79
- if ( language == WPGlobusCoreData.default_language ) {
80
- if ( /(\{:|\[:|<!--:)[a-z]{2}/.test(text) ) {
81
- text = '';
82
- }
83
- } else {
84
- text = api.TextFilter( text, WPGlobusCoreData.default_language );
85
- }
86
- }
87
- }
88
- return text;
89
- },
90
- addLocaleMarks: function(text, language) {
91
- return WPGlobusCoreData.locale_tag_start.replace('%s', language) + text + WPGlobusCoreData.locale_tag_end;
92
- },
93
- getTranslations: function(text) {
94
- var t = {},
95
- return_in;
96
- $.each(WPGlobusCoreData.enabled_languages, function(i,l){
97
- return_in = l == WPGlobusCoreData.default_language ? 'RETURN_IN_DEFAULT_LANGUAGE' : 'RETURN_EMPTY';
98
- t[l] = api.TextFilter(text, l, return_in);
99
- });
100
- return t;
101
- },
102
- getString: function(s, newVal, l) {
103
- if ( 'undefined' === typeof(s) ) {
104
- return s;
105
- }
106
- if ( 'undefined' === typeof(newVal) ) {
107
- newVal = '';
108
- }
109
- if ( 'undefined' === typeof(l) ) {
110
- l = WPGlobusCoreData.language;
111
- }
112
-
113
- s = api.getTranslations(s);
114
- s[l] = newVal;
115
-
116
- var cS = '';
117
-
118
- $.each(s, function(ln,val){
119
- if ( '' != val && ln != WPGlobusCoreData.default_language) {
120
- cS += api.addLocaleMarks(val, ln);
121
- }
122
- });
123
-
124
- if ( '' != s[WPGlobusCoreData.default_language] ) {
125
- if ( '' == cS ) {
126
- cS = s[WPGlobusCoreData.default_language];
127
- } else {
128
- cS = api.addLocaleMarks(s[WPGlobusCoreData.default_language], WPGlobusCoreData.default_language) + cS;
129
- }
130
- }
131
- return cS;
132
- }
133
- };
134
- })(jQuery);
135
-
136
- var WPGlobusDialogApp;
137
-
138
- (function($) {
139
-
140
- var api;
141
- api = WPGlobusDialogApp = {
142
- option : {
143
- listenClass : '.wpglobus_dialog_start',
144
- settingsClass : '.wpglobus_dialog_settings',
145
- dialogTabs: '#wpglobus-dialog-tabs',
146
- dialogTitle: '',
147
- customData: null,
148
- callback: function(){},
149
- dialogOptions: {
150
- title: '',
151
- placeholder: '',
152
- formFooter: '',
153
- beforeOpen: function(){},
154
- close: function(){},
155
- },
156
- dialog: {}
157
- },
158
- form : undefined,
159
- element : undefined,
160
- element_by : 'id',
161
- id : '',
162
- clone_id: '',
163
- wpglobus_id : '',
164
- type : 'textarea',
165
- source : '',
166
- order : {},
167
- value : {},
168
- request : 'core',
169
- attrs: {},
170
- dialogTitle: '',
171
- trClass: 'wpglobus-translatable',
172
- startButton: [
173
- '<span id="wpglobus-dialog-start-{{clone_id}}" ',
174
- 'style="{{style}}" ',
175
- 'data-type="control" data-dialog-title="{{title}}" ',
176
- 'data-source-type="" data-source-id="{{id}}" data-source-name="{{name}}" ',
177
- 'data-nodename="{{nodename}}"',
178
- '{{sbTitle}} ',
179
- 'class="{{classes}}"></span>'
180
- ].join(''),
181
- startButtonClass : 'wpglobus_dialog_start wpglobus_dialog_icon',
182
- clicks: 0,
183
- init: function(args) {
184
- api.option.dialog = api.option.dialogOptions;
185
- api.option = $.extend(api.option, args);
186
- $(api.option.dialogTabs).tabs();
187
- api.dialogTitle = api.option.dialogTitle;
188
- this.attachListener();
189
- if ( api.option.customData != null && typeof api.option.customData.addElements != 'undefined' ) {
190
- $.each(api.option.customData.addElements, function(i,e) {
191
- api.addElement(e);
192
- });
193
- }
194
- },
195
- convertToId: function(s){
196
- s = s.replace(/\]/g,'');
197
- s = s.replace(/\[/g,'-');
198
- return s;
199
- },
200
- addElement: function(elem) {
201
- var option = {
202
- id: null,
203
- style: '',
204
- styleTextareaWrapper: '',
205
- sbTitle: '',
206
- onChangeClass: '',
207
- dialogTitle: '',
208
- dialog: api.option.dialogOptions
209
- }
210
- if ( 'string' == typeof(elem) ) {
211
- option.id = elem;
212
- } else if ( 'object' == typeof(elem) ) {
213
- option = $.extend(option, elem);
214
- } else {
215
- return;
216
- }
217
-
218
- var $element = null, id = null, name = null, node = null,
219
- sb = api.startButton,
220
- clone, v, style, nodeName = '';
221
-
222
- api.element_by = 'name';
223
- node = document.getElementsByName(option.id);
224
-
225
- if ( 0 == node.length ) {
226
- api.element_by = 'id';
227
- node = document.getElementById(option.id);
228
- }
229
-
230
- if ( null === node ) {
231
- return;
232
- } else {
233
- id = option.id;
234
- if ( 'id' == api.element_by ) {
235
- $element = $('#'+id);
236
- } else {
237
- nodeName = node[0].nodeName;
238
- nodeName = nodeName.toLowerCase();
239
- $element = $(nodeName+'[name="'+id+'"]');
240
- }
241
- }
242
-
243
- if ( 'undefined' === typeof $element.attr('name') || '' == $element.attr('name') ) {
244
- name = id;
245
- } else {
246
- name = $element.attr('name');
247
- }
248
- api.clone_id = api.convertToId(id);
249
-
250
- if ( -1 != name.indexOf( 'wpglobus' ) || -1 != api.clone_id.indexOf( 'wpglobus' ) ) {
251
- /**
252
- * To prevent add element to itself.
253
- */
254
- return false;
255
- }
256
-
257
- if ( $( '#wpglobus-'+api.clone_id ).length > 0 ) {
258
- /**
259
- * WPGlobus element exists already.
260
- */
261
- return false;
262
- }
263
- if ( $( nodeName+'[name="wpglobus-'+name+'"]' ).length > 0 ) {
264
- /**
265
- * WPGlobus element exists already.
266
- */
267
- return false;
268
- }
269
-
270
- clone = $( $element.clone() );
271
- //$element.addClass('hidden');
272
- style = $element.attr('style') || '';
273
- $element.attr( 'style', 'display:none;' );
274
- clone.attr( 'id', 'wpglobus-'+api.clone_id ).attr( 'name', 'wpglobus-'+name );
275
-
276
- /**
277
- * Add WPGlobus translatable class.
278
- */
279
- clone.addClass( api.trClass );
280
-
281
- if ( option.onChangeClass != '' ) {
282
- /**
283
- * add class to bind 'change' event
284
- */
285
- clone.addClass( option.onChangeClass );
286
- }
287
-
288
- if ( 'id' == api.element_by ) {
289
- clone.attr('data-source-id', id).attr('data-source-name', '').attr('data-source-get-by',api.element_by);
290
- } else {
291
- clone.attr('data-source-id', '').attr('data-source-name', name).attr('data-source-get-by',api.element_by);
292
- }
293
-
294
- if ( 'textarea' == nodeName ) {
295
- v = WPGlobusCore.getTranslations( $element.val() )[WPGlobusCoreData['language']];
296
- clone.val( v );
297
- clone.attr( 'data-nodename', 'textarea' );
298
- if ( '' == option.style ) {
299
- clone.attr( 'style', style + ';width:95%;float:left;' );
300
- } else {
301
- clone.attr( 'style', style + ';' + option.style );
302
- }
303
- } else {
304
- v = WPGlobusCore.getTranslations( $element.val() )[WPGlobusCoreData['language']];
305
- clone.attr( 'value', v );
306
- clone.attr( 'data-nodename', 'input' );
307
- if ( '' != option.style ) {
308
- clone.attr( 'style', style + ';' + option.style );
309
- }
310
- }
311
-
312
- /**
313
- * Add dialog options.
314
- * @since 1.7.12
315
- */
316
- if ( '' != option.dialog ) {
317
- clone.attr( 'data-dialog', JSON.stringify(option.dialog) );
318
- }
319
-
320
- sb = sb.replace(/{{clone_id}}/g, api.clone_id);
321
- if ( 'id' == api.element_by ) {
322
- sb = sb.replace(/{{id}}/g, api.clone_id);
323
- sb = sb.replace(/{{name}}/g, '');
324
- sb = sb.replace(/{{nodename}}/g, '');
325
- } else {
326
- sb = sb.replace(/{{id}}/g, '');
327
- sb = sb.replace(/{{name}}/g, name);
328
- sb = sb.replace(/{{nodename}}/g, nodeName);
329
- }
330
- sb = 'textarea' == nodeName ? sb.replace( '{{style}}', 'float:left;margin-top:0;' ) : sb.replace( '{{style}}', '' );
331
- var startButtonClasses = 'textarea' == nodeName ? api.startButtonClass + ' wpglobus-textarea wpglobus-textarea-'+api.clone_id : api.startButtonClass;
332
- sb = sb.replace( '{{classes}}', startButtonClasses );
333
- sb = option.dialogTitle == '' ? sb.replace('{{title}}', api.dialogTitle) : sb.replace('{{title}}', option.dialogTitle);
334
- sb = option.sbTitle == '' ? sb.replace('{{sbTitle}}', option.sbTitle) : sb.replace('{{sbTitle}}', 'title="'+option.sbTitle+'"');
335
-
336
- $(sb).insertAfter($element);
337
- $(clone).insertAfter($element);
338
-
339
- if ( 'textarea' == nodeName ) {
340
- $('#wpglobus-'+api.clone_id).addClass( 'wpglobus-textarea-'+api.clone_id );
341
- $('.wpglobus-textarea-'+api.clone_id).wrapAll( '<div class="wpglobus-textarea-wrapper" style="'+option.styleTextareaWrapper+'"></div>' );
342
- }
343
-
344
- /**
345
- * Bind change event
346
- */
347
- var selector, ret = false;
348
- if ( option.onChangeClass == '' ) {
349
- selector = '#wpglobus-' + api.clone_id;
350
- } else {
351
- selector = '.' + option.onChangeClass;
352
- var $events = $._data( $(document)[0], 'events' );
353
- if( typeof $events === 'undefined' ){
354
- ret = true;
355
- } else {
356
- if ( typeof $events.change !== 'undefined' ) {
357
- $.each( $events.change, function(i, ev){
358
- if ( ev.selector == selector ) {
359
- ret = true;
360
- return false;
361
- }
362
- });
363
- }
364
- }
365
- }
366
-
367
- if ( ret ) {
368
- /**
369
- * Return because we had bound 'change' event already.
370
- */
371
- return true;
372
- }
373
-
374
- $(document).on( 'change', selector, function() {
375
- var $t = $(this),
376
- sid = $t.data( 'source-id' );
377
-
378
- if ( '' == sid ) {
379
- sid = $t.data( 'nodename' ) + '[name="' + $t.data( 'source-name' ) + '"]';
380
- } else {
381
- sid = '#' + sid;
382
- }
383
- $(sid).val( WPGlobusCore.getString( $(sid).val(), $t.val() ) );
384
- });
385
- return true;
386
- },
387
- saveDialog: function() {
388
- var s = '', sdl = '', scl = '', $e, val, l;
389
- $('.wpglobus_dialog_textarea').each(function(indx,e){
390
- $e = $(e);
391
- val = $e.val();
392
- l = $e.data('language');
393
- if ( l == WPGlobusAdmin.data.language ) {
394
- scl = val;
395
- }
396
- if ( val != '' ) {
397
- s = s + WPGlobusCore.addLocaleMarks(val,l);
398
- if ( l == WPGlobusCoreData.default_language ) {
399
- sdl = val;
400
- }
401
- }
402
- });
403
- s = s.length == sdl.length + 8 ? sdl : s;
404
- $(api.id).val(s);
405
- s = scl == '' ? sdl : scl;
406
- $(api.wpglobus_id).val(s);
407
- },
408
- dialog : $('#wpglobus-dialog-wrapper').dialog({
409
- autoOpen: false,
410
- //height: 250,
411
- width: 650,
412
- modal: true,
413
- dialogClass: 'wpglobus-dialog',
414
- buttons: [
415
- {
416
- text:'Save',
417
- class: 'wpglobus-button-save',
418
- click:function(){api.saveDialog(); api.dialog.dialog('close');}
419
- },
420
- {
421
- text:'Cancel',
422
- class: 'wpglobus-button-cancel',
423
- click: function(){api.dialog.dialog('close');}
424
- }
425
- ],
426
- open: function( event, ui ) {
427
- var title = api.dialogTitle;
428
- if ( typeof api.attrs.maxlength !== 'undefined' ) {
429
- $('.wpglobus_dialog_textarea').attr('maxlength', api.attrs.maxlength);
430
- title += ' | maxlength='+api.attrs.maxlength;
431
- }
432
- $('.wpglobus-dialog .ui-dialog-title').text(title);
433
- },
434
- close: function() {
435
- /**
436
- * Close callback.
437
- */
438
- api.runCallback( api.option.dialog.close );
439
-
440
- api.form[0].reset();
441
- //allFields.removeClass( "ui-state-error" );
442
- }
443
- }),
444
- attachListener : function() {
445
- $(document).on('click', api.option.settingsClass, function() {
446
- if ( $('.wpglobus_dialog_options_wrapper').hasClass('hidden') ) {
447
- $('.wpglobus_dialog_options_wrapper').removeClass('hidden');
448
- } else {
449
- $('.wpglobus_dialog_options_wrapper').addClass('hidden');
450
- }
451
- });
452
- $(document).on('click', '.wpglobus_dialog_option', function(event) {
453
- var $t = $(this), r;
454
- var ob = $t.data('object');
455
- api.order['action'] = 'save_post_meta_settings';
456
- api.order['post_type'] = WPGlobusAdmin.data.post_type;
457
- api.order['checked'] = $t.prop('checked');
458
- api.order['id'] = $t.attr('id');
459
- api.order['meta_key'] = $t.data('meta-key');
460
- r = api.ajax(api.order);
461
- r.done(function (result) {
462
- if ( result.result == 'ok' ) {
463
- if ( result.checked == 'true' ) {
464
- $(ob).removeClass('wpglobus_dialog_start_hidden');
465
- } else {
466
- $(ob).addClass('wpglobus_dialog_start_hidden');
467
- }
468
- }
469
- })
470
- .fail(function (error) {})
471
- .always(function (jqXHR, status){});
472
- });
473
- $(document).on('click', api.option.listenClass, function(e) {
474
- api.element = $(this);
475
- api.id = api.element.data('source-id');
476
- if ( '' == api.id ) {
477
- api.id = api.element.data('nodename') + '[name="'+api.element.data('source-name')+'"]';
478
- api.wpglobus_id = '#wpglobus-'+api.convertToId( api.element.data('source-name') );
479
- } else {
480
- api.wpglobus_id = '#wpglobus-'+api.id;
481
- api.id = '#'+api.id;
482
- }
483
-
484
- api.clicks++;
485
- if ( api.clicks == 1 ) {
486
- setTimeout(function () {
487
- if (api.clicks == 1) {
488
- api.onClick(e);
489
- } else {
490
- var s = $(api.id);
491
- if ( s.hasClass('hidden') ) {
492
- s.removeClass('hidden').attr('style', 'display:block;');
493
- } else {
494
- s.addClass('hidden').attr('style', 'display:none;');
495
- }
496
- }
497
- api.clicks = 0;
498
- }, 200);
499
- }
500
- });
501
- api.form = api.dialog.find('form#wpglobus-dialog-form').on('submit', function( event ) {
502
- event.preventDefault();
503
- api.saveDialog();
504
- });
505
- },
506
- ajax : function(order) {
507
- return $.ajax({type:'POST', url:WPGlobusAdmin.ajaxurl, data:{action:WPGlobusAdmin.process_ajax, order:order}, dataType:'json', async:false});
508
- },
509
- onClick: function(ev) {
510
- if ( typeof(api.element.data('dialog-title')) == 'undefined' || '' == api.element.data('dialog-title') ) {
511
- api.dialogTitle = api.option.dialogTitle;
512
- } else {
513
- api.dialogTitle = api.element.data('dialog-title');
514
- }
515
- if ( typeof api.id !== 'undefined' ) {
516
- api.attrs['maxlength'] = $(api.id).attr('maxlength');
517
- }
518
-
519
- api.source = api.element.data('source-value');
520
- if ( typeof api.source === 'undefined' ) {
521
- api.source = $(api.id).val();
522
- if (api.request == 'ajax') {
523
- // @todo revise ajax action
524
- //api.order['action'] = 'get_translate';
525
- //api.order['source'] = api.source;
526
- //api.ajax(api.order);
527
- } else {
528
- api.value = WPGlobusCore.getTranslations(api.source);
529
- }
530
- }
531
-
532
- /**
533
- * Get dialog form options.
534
- */
535
- api.option.dialog = $.extend( {}, api.option.dialogOptions, $(api.wpglobus_id).data('dialog') );
536
-
537
- if ( '' != api.option.dialog.title ) {
538
- api.dialogTitle = api.option.dialog.title;
539
- }
540
-
541
- $.each(api.value, function(l,e){
542
- var $d = $('#wpglobus-dialog-'+l);
543
- /**
544
- * Value.
545
- */
546
- $d.val(e);
547
-
548
- /**
549
- * Placeholder.
550
- */
551
- $d.attr(
552
- 'placeholder',
553
- WPGlobusCore.TextFilter( api.option.dialog.placeholder, l, 'RETURN_IN_DEFAULT_LANGUAGE' )
554
- );
555
- });
556
-
557
- /**
558
- * Dialog form footer.
559
- */
560
- $('#wpglobus-dialog-form-footer').html(api.option.dialog.formFooter);
561
-
562
- /**
563
- * Before open callback.
564
- */
565
- api.runCallback( api.option.dialog.beforeOpen );
566
-
567
- api.dialog.dialog('open');
568
- },
569
- runCallback: function(callback) {
570
-
571
- if ( 'object' === typeof callback ) {
572
- var k = Object.keys(callback)[0];
573
- var fn = callback[Object.keys(callback)[0]]
574
- if ( 'window' === k ) {
575
- if ( 'function' === typeof window[fn] ) {
576
- window[fn]( callback[Object.keys(callback)[1]] );
577
- }
578
- } else if ( 'function' === typeof window[k][fn] ) {
579
- window[k][fn]( callback[Object.keys(callback)[1]] );
580
- }
581
- } else if ( 'string' === typeof callback ) {
582
- if ( 'function' === typeof window[callback] ) {
583
- window[callback]();
584
- }
585
- }
586
-
587
- }
588
- };
589
-
590
- })(jQuery);
591
-
592
- jQuery(document).ready(function () {
593
- "use strict";
594
- window.WPGlobusAdminApp = (function (WPGlobusAdminApp, $) {
595
- /* Object Constructor
596
- ========================*/
597
- WPGlobusAdminApp.App = function (config) {
598
-
599
- if ( 'undefined' !== typeof window.WPGlobusAdminApp ) {
600
- return;
601
- }
602
-
603
- this.config = {
604
- debug: false,
605
- version: WPGlobusAdmin.version
606
- };
607
-
608
- this.status = 'ok';
609
-
610
- if ( 'undefined' === typeof WPGlobusAdmin ) {
611
- this.status = 'error';
612
- if (this.config.debug) {
613
- console.log('WPGlobus: error options loading');
614
- }
615
- } else {
616
- if (this.config.debug) {
617
- console.dir(WPGlobusAdmin);
618
- }
619
- }
620
-
621
- this.config.disable_first_language = [
622
- '<div id="disable_first_language" style="display:block;" class="redux-field-errors notice-red">',
623
- '<strong>',
624
- '<span>&nbsp;</span>',
625
- WPGlobusAdmin.i18n.cannot_disable_language,
626
- '</strong>',
627
- '</div>'
628
- ].join('');
629
-
630
- $.extend(this.config, config);
631
-
632
- if ('ok' === this.status) {
633
- this.init();
634
- }
635
- };
636
-
637
- WPGlobusAdminApp.App.prototype = {
638
- $document : $(document),
639
- init: function () {
640
- WPGlobusCoreData.multisite = this.parseBool(WPGlobusCoreData.multisite);
641
- this.adminInit();
642
- $('#content').addClass('wpglobus-editor').attr('data-language',WPGlobusAdmin.data.default_language);
643
- $('textarea[id^=content_]').each(function(i,e){
644
- var l=$(e).attr('id').replace('content_','');
645
- $(e).attr('data-language',l);
646
- });
647
- if ('post.php' === WPGlobusAdmin.page) {
648
- this.postEdit();
649
- this.set_dialog();
650
- if ( 'undefined' !== typeof WPGlobusAioseop ) {
651
- WPGlobusAioseop.init();
652
- }
653
- } else if ('menu-edit' === WPGlobusAdmin.page) {
654
- this.navMenus();
655
- } else if ('taxonomy-edit' === WPGlobusAdmin.page) {
656
- if (WPGlobusAdmin.data.tag_id) {
657
- this.taxonomyEdit();
658
- }
659
- } else if ('taxonomy-quick-edit' === WPGlobusAdmin.page) {
660
- this.quickEdit('taxonomy');
661
- } else if ('edit.php' === WPGlobusAdmin.page) {
662
- this.quickEdit('post');
663
- } else if ('options-general.php' == WPGlobusAdmin.page) {
664
- this.optionsGeneral();
665
- } else if ('widgets.php' == WPGlobusAdmin.page) {
666
- WPGlobusWidgets.init();
667
- WPGlobusDialogApp.init({dialogTitle:'Edit text'});
668
- } else if ('wpglobus_options' == WPGlobusAdmin.page) {
669
- this.start();
670
- } else if ('wpglobusAdminCentral' == WPGlobusAdmin.page) {
671
- this.adminCentral();
672
- } else {
673
- /**
674
- * Init WPGlobusDialogApp for using in a 3-party plugins.
675
- */
676
- WPGlobusDialogApp.init({customData:WPGlobusCoreData.page_custom_data});
677
- }
678
- },
679
- parseBool: function(b) {
680
- return !(/^(false|0)$/i).test(b) && !!b;
681
- },
682
- getCurrentTab: function() {
683
- return $( '.wpglobus-post-body-tabs-list .ui-tabs-active' ).data( 'language' );
684
- },
685
- adminInit: function () {
686
- var order = $('.wpglobus-addons-group a').data('key');
687
- if ( 'undefined' !== typeof order ) {
688
- if ( window.location.search.indexOf('page=wpglobus_options&tab='+order) >= 0 ) {
689
- if ( WPGlobusCoreData.multisite ) {
690
- window.location = WPGlobusCoreData.pluginInstallLocation.multisite;
691
- } else {
692
- window.location = WPGlobusCoreData.pluginInstallLocation.single;
693
- }
694
- } else {
695
- var addon = $('#toplevel_page_wpglobus_options li').eq(order+1);
696
- if ( WPGlobusCoreData.multisite ) {
697
- $(addon).find('a').attr('href',WPGlobusCoreData.pluginInstallLocation.multisite).attr('onclick',"window.location=jQuery(this).attr('href');return false;");
698
- } else {
699
- $(addon).find('a').attr('href',WPGlobusCoreData.pluginInstallLocation.single).attr('onclick',"window.location=jQuery(this).attr('href');return false;");
700
- }
701
- }
702
- }
703
- },
704
- optionsGeneral: function() {
705
- var $bn = $('#blogname'),
706
- $body = $('body');
707
-
708
- $bn.addClass('hidden');
709
- $('#wpglobus-blogname').insertAfter($bn).removeClass('hidden');
710
-
711
- $body.on('blur', '.wpglobus-blogname', function () {
712
- $('.wpglobus-blogname').each( function (i, e) {
713
- var $e = $(e);
714
- $bn.val( WPGlobusCore.getString( $bn.val(), $e.val(), $e.data('language') ) );
715
- });
716
- });
717
-
718
- var $bd = $('#blogdescription');
719
- $bd.addClass('hidden');
720
- $('#wpglobus-blogdescription').insertAfter($bd).removeClass('hidden');
721
- $body.on('blur', '.wpglobus-blogdesc', function () {
722
- $('.wpglobus-blogdesc').each( function (i, e) {
723
- var $e = $(e);
724
- $bd.val( WPGlobusCore.getString( $bd.val(), $e.val(), $e.data('language') ) );
725
- });
726
- });
727
- },
728
- quickEdit: function(type) {
729
- /**
730
- * For more info @see ajax handler 'wp_ajax_inline_save'.
731
- */
732
- if ( 'undefined' === typeof WPGlobusAdmin.data.has_items ) {
733
- return;
734
- }
735
- if (!WPGlobusAdmin.data.has_items) {
736
- return;
737
- }
738
- var full_id = '', id = 0;
739
-
740
- $(document).ajaxComplete(function(event, jqxhr, settings){
741
- if (typeof settings.data === 'undefined') {
742
- return;
743
- }
744
- if ( full_id == '' ) {
745
- return;
746
- }
747
- if (settings.data.indexOf('action=inline-save-tax&') >= 0) {
748
- $('#'+full_id+' a.row-title').text(WPGlobusAdmin.qedit_titles[id][WPGlobusAdmin.data.language]['name']);
749
- $('#'+full_id+' .description').text(WPGlobusAdmin.qedit_titles[id][WPGlobusAdmin.data.language]['description']);
750
- }
751
- });
752
-
753
- var title = {};
754
- $('#the-list tr').each(function (i, e) {
755
- var $e = $(e);
756
- var k = ( type === 'post' ? 'post-' : 'tag-' );
757
- id = $e.attr('id').replace(k, ''); /* don't need var with id, see line 109 */
758
- title[id] = {};
759
- if ('post' === type) {
760
- title[id]['source'] = $e.find('.post_title').text();
761
- } else if ('taxonomy' === type) {
762
- title[id]['source'] = $('#inline_' + id + ' .name').text();
763
- }
764
- });
765
-
766
- var order = {};
767
- order['action'] = 'get_titles';
768
- order['type'] = type;
769
- order['taxonomy'] = typeof WPGlobusAdmin.data.taxonomy === 'undefined' ? false : WPGlobusAdmin.data.taxonomy;
770
- order['title'] = title;
771
- $.ajax({type:'POST', url:WPGlobusAdmin.ajaxurl, data:{action:WPGlobusAdmin.process_ajax, order:order}, dataType:'json'})
772
- .done(function (result) {
773
- WPGlobusAdmin.qedit_titles = result.qedit_titles;
774
- $.each(result.bulkedit_post_titles, function(id, obj){
775
- $('#inline_'+id+' .post_title').text(obj[WPGlobusAdmin.data.language]['name']);
776
- });
777
- })
778
- .fail(function (error) {
779
- })
780
- .always(function (jqXHR, status) {
781
- });
782
-
783
- $('body').on('change', '.wpglobus-quick-edit-title', function () {
784
- var s = '';
785
- var lang = [];
786
- $('.wpglobus-quick-edit-title').each(function (index, e) {
787
- var $e = $(e);
788
- var l = $e.data('language');
789
- if ($e.val() !== '') {
790
- s = WPGlobusCore.getString( s, $e.val(), l );
791
- }
792
- WPGlobusAdmin.qedit_titles[ id ][ l ][ 'name' ] = $e.val();
793
- lang[ index ] = l;
794
- });
795
-
796
- var so = $(document).triggerHandler( 'wpglobus_get_translations', {string:s, lang:lang, id:id} );
797
- if ( typeof so !== 'undefined' ) {
798
- s = so;
799
- }
800
- $( 'input.ptitle' ).eq( 0 ).attr( 'value', s ) ;
801
- WPGlobusAdmin.qedit_titles[ id ][ 'source' ] = s;
802
- });
803
-
804
- if ( typeof WPGlobusAdmin.data.tags !== 'undefined' ) {
805
- $.each( WPGlobusAdmin.data.tags, function(i,tag){
806
- WPGlobusAdmin.data.value[tag]['post_id'] = {};
807
- });
808
- }
809
-
810
- $('button.save, input#bulk_edit').on('mouseenter', function (event) {
811
- /**
812
- * Quick edit action for the "Tags" box in edit.php page.
813
- */
814
- if ( typeof WPGlobusAdmin.data.tags === 'undefined' ) {
815
- return;
816
- }
817
-
818
- if (event.currentTarget.id=='bulk_edit') {
819
- $('input#bulk_edit').unbind('click');
820
- } else {
821
- $('button.save').unbind('click');
822
- }
823
-
824
- $( 'button.save, input#bulk_edit').on('click', function (event) {
825
- //console.log( 'Start Updating' );
826
- var promise = $.when();
827
-
828
- var tagsHandler = function( $elem ) {
829
- $elem.next('.spinner').css({'visibility':'visible'});
830
- if (event.currentTarget.id != 'bulk_edit') {
831
- $.ajaxSetup({async:false});
832
- }
833
- var p = $elem.parents('tr');
834
- var id = p.attr('id').replace('edit-','');
835
- var t,v,newTags;
836
-
837
- $.each( WPGlobusAdmin.data.tags, function(index,tag){
838
- t = p.find("textarea[name='" + WPGlobusAdmin.data.names[tag] + "']");
839
- if ( t.length == 0 ) {
840
- return true;
841
- }
842
- WPGlobusAdmin.data.value[tag]['post_id'][id] = t.val();
843
- v = WPGlobusAdmin.data.value[tag]['post_id'][id].split(',');
844
- newTags = [];
845
- for(var i=0; i<v.length; i++) {
846
- v[i] = v[i].trim(' ');
847
- if ( v[i] != '' ) {
848
- if ( typeof WPGlobusAdmin.data.tag[tag][v[i]] === 'undefined' ) {
849
- newTags[i] = v[i];
850
- } else {
851
- newTags[i] = WPGlobusAdmin.data.tag[tag][v[i]];
852
- }
853
- }
854
- }
855
- t.val( newTags.join(', ') );
856
- });
857
- }
858
-
859
- var $this = $(this);
860
- var start = $.Deferred();
861
- start.resolve( tagsHandler( $(this) ) );
862
-
863
- promise = promise.then(function() {
864
- return $.when(
865
- start.done()
866
- )
867
- }).then( function() {
868
- if (event.currentTarget.id != 'bulk_edit') {
869
- setTimeout(
870
- function() {
871
- inlineEditPost.save(id);
872
- $.ajaxSetup({async:true});
873
- },
874
- 50
875
- );
876
- }
877
- });
878
-
879
- });
880
- });
881
-
882
- $( '#the-list' ).on( 'click', 'a.editinline', function () {
883
- var t = $(this);
884
- full_id = t.parents('tr').attr('id');
885
- if ('post' === type) {
886
- id = full_id.replace('post-', '');
887
- } else if ('taxonomy' === type) {
888
- id = full_id.replace('tag-', '');
889
- } else {
890
- return;
891
- }
892
-
893
- if ( 'post' === type && 'undefined' !== typeof WPGlobusAdmin.data.tags ) {
894
- /**
895
- * @since 1.6.6
896
- */
897
- $.each( WPGlobusAdmin.data.tags, function(i,tag){
898
- if ( WPGlobusAdmin.data.value[tag] != '' ) {
899
- var val = $('#edit-' + id + ' textarea[name="' + WPGlobusAdmin.data.names[tag] + '"]').val(),
900
- currentTags;
901
- if ( 'undefined' !== typeof val ) {
902
- currentTags = val.split(',');
903
- $.each( currentTags, function(order,currentTag) {
904
- val = val.replace(currentTag, WPGlobusCore.TextFilter(currentTag, WPGlobusCoreData.language));
905
- });
906
- $('#edit-' + id + ' textarea[name="' + WPGlobusAdmin.data.names[tag] + '"]').val(val);
907
- }
908
- }
909
- });
910
- }
911
-
912
- var e = $('#edit-' + id + ' input.ptitle').eq(0);
913
- var p = e.parents('label');
914
- e.val(WPGlobusAdmin.qedit_titles[id].source);
915
- e.addClass('hidden');
916
- $(WPGlobusAdmin.data.template).insertAfter(p);
917
-
918
- if ( typeof WPGlobusAdmin.qedit_titles[id] === 'undefined' ) {
919
- WPGlobusAdmin.qedit_titles[id] = {};
920
- WPGlobusAdmin.qedit_titles[id]['source'] = $('#'+full_id+' .name a.row-title').text();
921
- $(WPGlobusAdmin.data.enabled_languages).each(function(i,l){
922
- WPGlobusAdmin.qedit_titles[id][l] = {};
923
- if ( l == WPGlobusAdmin.data.default_language ) {
924
- WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id]['source'];
925
- } else {
926
- WPGlobusAdmin.qedit_titles[id][l]['name'] = '';
927
- }
928
- WPGlobusAdmin.qedit_titles[id][l]['description'] = '';
929
- });
930
- }
931
-
932
- $( '.wpglobus-quick-edit-title' ).each(function ( i, e ) {
933
- var $e = $(e);
934
- var l = $e.data( 'language' );
935
- $e.attr( 'id', l + id );
936
- if ( typeof WPGlobusAdmin.qedit_titles[id][l] !== 'undefined' ) {
937
- WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id][l]['name'].replace( /\\\'/g, "'" );
938
- WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id][l]['name'].replace( /\\\"/g, '"' );
939
- $e.attr( 'value', WPGlobusAdmin.qedit_titles[id][l]['name'] );
940
- WPGlobusAdmin.qedit_titles[id]['source'] =
941
- WPGlobusCore.getString(
942
- WPGlobusAdmin.qedit_titles[id]['source'],
943
- WPGlobusAdmin.qedit_titles[id][l]['name'],
944
- l
945
- );
946
- }
947
- });
948
- $( 'input.ptitle' ).eq( 0 ).attr( 'value', WPGlobusAdmin.qedit_titles[ id ][ 'source' ] );
949
- });
950
-
951
- },
952
- taxonomyEdit: function () {
953
-
954
- var elements = [];
955
- elements[0] = 'name';
956
- elements[1] = 'description';
957
-
958
- var make_clone = function(id,language){
959
- var $element = $('#'+id),
960
- clone = $element.clone(),
961
- name = $element.attr('name'),
962
- classes = 'wpglobus-element wpglobus-element_'+id+' wpglobus-element_'+language+' wpglobus-translatable',
963
- node;
964
-
965
- node = document.getElementById(id);
966
- node = node.nodeName;
967
- $(clone).attr('id', id+'_'+language);
968
- $(clone).attr('name', name+'_'+language);
969
- if ( language !== WPGlobusCoreData.default_language ) {
970
- classes += ' hidden';
971
- }
972
- $(clone).attr('class', classes);
973
- $(clone).attr('data-save-to', id);
974
- $(clone).attr('data-language', language);
975
- if ( node == 'INPUT' ) {
976
- $(clone).attr('value', $('#wpglobus-link-tab-'+language).data(id));
977
- } else if ( node == 'TEXTAREA' ) {
978
- $(clone).text($('#wpglobus-link-tab-'+language).data(id));
979
- }
980
- $element.addClass('hidden');
981
- if ( $('.wpglobus-element_'+id).length == 0 ) {
982
- $(clone).insertAfter($element);
983
- } else {
984
- $(clone).insertAfter($('.wpglobus-element_'+id).last());
985
- }
986
- };
987
-
988
- $.each(WPGlobusCoreData.enabled_languages, function(i,l){
989
- $.each(elements, function(i,e){
990
- make_clone(e,l);
991
- });
992
- });
993
-
994
- $('.wpglobus-taxonomy-tabs').insertAfter('#ajax-response');
995
-
996
- /**
997
- * Make class wrap as tabs container.
998
- * Tabs on.
999
- */
1000
- $('.wrap').tabs();
1001
-
1002
- $('body').on('click', '.wpglobus-taxonomy-tabs li', function(event){
1003
- var $t = $(this);
1004
- var language = $t.data('language');
1005
- $('.wpglobus-element').addClass('hidden');
1006
- $('.wpglobus-element_'+language).removeClass('hidden');
1007
- });
1008
-
1009
- $('.wpglobus-element').on('change', function () {
1010
- var $this = $(this),
1011
- save_to = $this.data('save-to'),
1012
- s = '';
1013
-
1014
- $('.wpglobus-element').each(function (index, element) {
1015
- var $e = $(element),
1016
- value = $e.val();
1017
- if ( $e.data('save-to') == save_to && value !== '' ) {
1018
- s = s + WPGlobusCore.addLocaleMarks(value, $e.data('language') )
1019
- }
1020
- });
1021
- $('#' + save_to).val(s);
1022
- });
1023
-
1024
- /**
1025
- * @since 1.8.1
1026
- * $('<span class="wpglobus-multilingual-slug wpglobus_dialog_start wpglobus_dialog_icon" title="Title"></span>').insertBefore('#slug');
1027
- * $('.term-slug-wrap th').css({'padding-right':'0'});
1028
- * $('.term-slug-wrap td').css({'padding-left':'0'});
1029
- */
1030
- $(WPGlobusAdmin.data.multilingualSlug.title).insertAfter('.term-slug-wrap th label');
1031
-
1032
- },
1033
- navMenus: function () {
1034
- var iID, menu_size,
1035
- menu_item = '#menu-to-edit .menu-item';
1036
-
1037
- var timer = function () {
1038
- if ( menu_size !== $(menu_item).length ) {
1039
- clearInterval(iID);
1040
- $(menu_item).each(function (index, li) {
1041
- var $li = $(li);
1042
- if ($li.hasClass('wpglobus-menu-item')) {
1043
- return; /** the same as continue */
1044
- }
1045
- var id = $(li).attr('id');
1046
- $.each(['input.edit-menu-item-title', 'input.edit-menu-item-attr-title'], function (input_index, input) {
1047
- var i = $('#' + id + ' ' + input);
1048
- var $i = $(i);
1049
- if (!$i.hasClass('wpglobus-hidden')) {
1050
- $i.addClass('wpglobus-hidden');
1051
- $i.css('display', 'none');
1052
- var l = $i.parent('label');
1053
- var p = $i.parents('p');
1054
- $(p).css('height', '80px');
1055
- $(l).append('<div style="color:#f00;">' + WPGlobusAdmin.i18n.save_nav_menu + '</div>');
1056
- }
1057
- });
1058
- $li.addClass('wpglobus-menu-item');
1059
- });
1060
- }
1061
- };
1062
-
1063
- $.ajaxSetup({
1064
- beforeSend: function (jqXHR, PlainObject) {
1065
- if (typeof PlainObject.data === 'undefined') {
1066
- return;
1067
- }
1068
- if (PlainObject.data.indexOf('action=add-menu-item') >= 0) {
1069
- menu_size = $(menu_item).length;
1070
- iID = setInterval(timer, 500);
1071
- }
1072
- }
1073
- });
1074
-
1075
- $(menu_item).each(function (index, li) {
1076
-
1077
- var id = $(li).attr('id'),
1078
- item_id = id.replace('menu-item-', '');
1079
-
1080
- $.each(['input.edit-menu-item-title', 'input.edit-menu-item-attr-title'], function (input_index, input) {
1081
- var $i = $('#' + id + ' ' + input);
1082
- if ( $i.val() != WPGlobusAdmin.data.items[ item_id ][ input ][ 'source' ] ) {
1083
- /**
1084
- * fix for case when value resets by WP core
1085
- */
1086
- $i.val( WPGlobusAdmin.data.items[ item_id ][ input ][ 'source' ] );
1087
- }
1088
-
1089
- var p = $( '#' + id + ' ' + input ).parents('p');
1090
- var height = 0;
1091
-
1092
- $.each(WPGlobusAdmin.data.open_languages, function (index, language) {
1093
- var new_element = $i.clone();
1094
- new_element.attr('id', $i.attr('id') + '-' + language);
1095
- new_element.attr('name', $i.attr('id') + '-' + language);
1096
- new_element.attr('data-language', language);
1097
- new_element.attr('data-item-id', item_id);
1098
- new_element.attr('placeholder', WPGlobusAdmin.data.en_language_name[language]);
1099
-
1100
- var classes = WPGlobusAdmin.data.items[item_id][language][input]['class'];
1101
- if (input_index === 0 && language === WPGlobusAdmin.data.default_language) {
1102
- new_element.attr('class', classes + ' edit-menu-item-title');
1103
- } else {
1104
- new_element.attr('class', classes);
1105
- }
1106
-
1107
- if ( WPGlobusAdmin.data.items[ item_id ][ language ][ input ][ 'caption' ] != '' ) {
1108
- new_element.attr('value', WPGlobusAdmin.data.items[item_id][language][input]['caption']);
1109
- } else {
1110
- new_element.attr('value', '');
1111
- }
1112
- new_element.css('margin-bottom', '0.6em');
1113
- $(p).append( new_element );
1114
- height = index;
1115
- });
1116
- height = (height + 1) * 40;
1117
- $i.css('display', 'none').attr('class', '').addClass('widefat wpglobus-hidden');
1118
- $(p).css('height', height + 'px').addClass('wpglobus-menu-item-box');
1119
-
1120
- });
1121
- $(li).addClass('wpglobus-menu-item');
1122
- });
1123
-
1124
- $('.menus-move-left, .menus-move-right').each(function(index,e) {
1125
- var $e = $(e), new_title;
1126
- var item_id = $e.parents('li').attr('id').replace('menu-item-', '');
1127
- var title = $e.attr('title');
1128
- if ( typeof title !== 'undefined' ) {
1129
- $.each(WPGlobusAdmin.data.post_titles, function(post_title, item_title) {
1130
- if ( title.indexOf(post_title) >= 0 ) {
1131
- new_title = title.replace(post_title, item_title);
1132
- $e.attr('title', new_title);
1133
- $e.text(new_title);
1134
- }
1135
- });
1136
- }
1137
- });
1138
-
1139
- /**
1140
- * Run the item handle title when the navigation label was loaded.
1141
- * @see wp-admin\js\nav-menu.js
1142
- */
1143
- $('.edit-menu-item-title').trigger('change');
1144
- wpNavMenu.refreshAdvancedAccessibility();
1145
- wpNavMenu.menusChanged = false;
1146
-
1147
- $('.wpglobus-menu-item').on('change', function () {
1148
- var $this = $(this),
1149
- item_id = $this.data('item-id'),
1150
- s, so;
1151
- if ($this.hasClass('wpglobus-item-title')) {
1152
- s = WPGlobusCore.getString( $('input#edit-menu-item-title-' + item_id).val(), $this.val(), $this.data('language') );
1153
- so = $(document).triggerHandler('wpglobus_get_menu_translations', {string:s, lang:WPGlobusCoreData.open_languages, id:item_id, type:'input.edit-menu-item-title'});
1154
- if ( typeof so !== 'undefined' ) {
1155
- s = so;
1156
- }
1157
- $('input#edit-menu-item-title-' + item_id).val(s);
1158
- }
1159
- if ($this.hasClass('wpglobus-item-attr')) {
1160
- s = WPGlobusCore.getString( $('input#edit-menu-item-attr-title-' + item_id).val(), $this.val(), $this.data('language') );
1161
- so = $(document).triggerHandler('wpglobus_get_menu_translations', {string:s, lang:WPGlobusCoreData.open_languages, id:item_id, type:'input.edit-menu-item-attr-title'});
1162
- if ( typeof so !== 'undefined' ) {
1163
- s = so;
1164
- }
1165
- $('input#edit-menu-item-attr-title-' + item_id).val(s);
1166
- }
1167
-
1168
- });
1169
- },
1170
- postEdit: function () {
1171
- /**
1172
- * Hook into the heartbeat-send.
1173
- */
1174
- $(document).on('heartbeat-send', function(e, data) {
1175
- if ( typeof data['wp_autosave'] !== 'undefined' ) {
1176
- data['wpglobus_heartbeat'] = 'wpglobus';
1177
- $.each(WPGlobusAdmin.data.open_languages, function(i,l){
1178
- var v = $('#title_'+l).val() || '';
1179
- v = $.trim(v);
1180
- if ( v != '' ) {
1181
- data['wp_autosave']['post_title_'+l] = v;
1182
- }
1183
- v = $('#content_'+l).val() || '';
1184
- v = $.trim(v);
1185
- if ( v != '' ) {
1186
- data['wp_autosave']['content_'+l] = v;
1187
- }
1188
- });
1189
- }
1190
- });
1191
-
1192
- var wrap_at = '#postdivrich',
1193
- set_title = true,
1194
- content_tabs_id = '#post-body-content';
1195
- if ( WPGlobusAdmin.data.support['editor'] === false ) {
1196
- wrap_at = '#titlediv';
1197
- set_title = false;
1198
- }
1199
- if ( WPGlobusAdmin.data.support['title'] === false ) {
1200
- set_title = false;
1201
- }
1202
- /**
1203
- * Make post-body-content as tabs container.
1204
- */
1205
- $(content_tabs_id).prepend($('.wpglobus-post-body-tabs-list'));
1206
- $.each(WPGlobusAdmin.tabs, function (index, suffix) {
1207
- if ('default' === suffix) {
1208
- $(wrap_at).wrap('<div id="tab-default"></div>');
1209
- if ( set_title ) {
1210
- $($('#titlediv')).insertBefore(wrap_at);
1211
- }
1212
- } else {
1213
- $(wrap_at+'-' + suffix).wrap('<div id="tab-' + suffix + '"></div>');
1214
- if ( set_title ) {
1215
- $($('#titlediv-' + suffix)).insertBefore(wrap_at+'-' + suffix);
1216
- }
1217
- }
1218
- });
1219
-
1220
- /**
1221
- * Tabs on.
1222
- */
1223
- $(content_tabs_id).addClass('wpglobus-post-body-tabs').tabs({
1224
- beforeActivate: function( event, ui ){
1225
- var otab = ui.oldTab[0].id.replace('link-tab-','');
1226
- var ntab = ui.newTab[0].id.replace('link-tab-','');
1227
- if ( 'default' == otab ) {
1228
- otab = WPGlobusCoreData.default_language;
1229
- }
1230
- if ( 'default' == ntab ) {
1231
- ntab = WPGlobusCoreData.default_language;
1232
- }
1233
- var a = $(document).triggerHandler('wpglobus_post_body_tabs', [ otab, ntab ]);
1234
- if ( a || typeof a === 'undefined' ) {
1235
- return true;
1236
- }
1237
- return false;
1238
- }
1239
- }); /** #post-body-content */
1240
-
1241
- /**
1242
- * Setup for default language.
1243
- */
1244
- $('#title').val(WPGlobusAdmin.title);
1245
-
1246
- /**
1247
- * See other places with the same bookmark.
1248
- * @bookmark EDITOR_LINE_BREAKS
1249
- */
1250
- //$('#content').text(WPGlobusAdmin.content.replace(/\n/g, "<p>"));
1251
-
1252
- $('#content').text(WPGlobusAdmin.content);
1253
-
1254
- if (typeof WPGlobusVendor !== "undefined" && WPGlobusVendor.vendor.WPSEO ) {
1255
- if ( typeof wpglobus_wpseo !== "undefined" ) {
1256
- wpglobus_wpseo();
1257
- } else if ( 'undefined' !== typeof WPGlobusYoastSeo ) {
1258
- if ( 'undefined' !== typeof WPGlobusYoastSeoPremium ) {
1259
- /**
1260
- * @since WPGlobus 1.7.2
1261
- */
1262
- if ( WPGlobusYoastSeoPremium ) {
1263
- WPGlobusYoastSeoPremium.init();
1264
- }
1265
- }
1266
- /**
1267
- * @since Yoast SEO 3.0
1268
- */
1269
- WPGlobusYoastSeo.init();
1270
- }
1271
- }
1272
-
1273
- if ( WPGlobusAdmin.data.modify_excerpt ) {
1274
- /**
1275
- * Add excerpt fields from template.
1276
- */
1277
- var $excerpt = $( '#excerpt' );
1278
- $excerpt.addClass( 'hidden' ).css( {'display':'none'} );
1279
- $( WPGlobusAdmin.data.template ).insertAfter( $excerpt );
1280
- $( 'body' ).on( 'change', '.wpglobus-excerpt', function () {
1281
- var $t = $( this );
1282
- $excerpt.val( WPGlobusCore.getString( $excerpt.val(), $t.val(), $t.data('language') ) );
1283
- });
1284
- }
1285
-
1286
- /**
1287
- * wp_editor word count.
1288
- * from WordPress 4.3 @see \wp-admin\js\post.js
1289
- */
1290
- if ( typeof wp.utils !== 'undefined' && typeof wp.utils.WordCounter !== 'undefined' ) {
1291
- WPGlobusCoreData.wordCounter = {};
1292
-
1293
- var self = this, wpglobusEditors = {};
1294
-
1295
- $.each( WPGlobusCoreData.enabled_languages, function( i, l ){
1296
- if ( l == WPGlobusCoreData.default_language ) {
1297
- return true;
1298
- }
1299
- wpglobusEditors[i] = 'content_'+l;
1300
-
1301
- ( function( $, counter, l ) {
1302
- WPGlobusCoreData.wordCounter[ l ] = {};
1303
- WPGlobusCoreData.wordCounter[ l ][ 'counter' ] = counter;
1304
-
1305
- $( function() {
1306
-
1307
- WPGlobusCoreData.wordCounter[ l ][ 'content' ] = $( '#content_'+l );
1308
- WPGlobusCoreData.wordCounter[ l ][ 'count' ] = $( '#wp-word-count-'+l ).find( '.word-count-'+l );
1309
-
1310
- WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] = 0;
1311
-
1312
- function update( l ) {
1313
- var text, count;
1314
-
1315
- if ( typeof l === 'object' ) {
1316
-
1317
- if ( l == 'tinymce' ) {
1318
- /** wysiwyg editor */
1319
- l = self.getCurrentTab();
1320
- } else {
1321
- /** textarea */
1322
- l = l.target.id.replace( 'content_', '' );
1323
- }
1324
-
1325
- }
1326
-
1327
- if ( typeof WPGlobusCoreData.wordCounter[ l ] === 'undefined' ) {
1328
- return;
1329
- }
1330
-
1331
- if ( ! WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ] ||
1332
- WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ].isHidden() ) {
1333
-
1334
- text = WPGlobusCoreData.wordCounter[ l ][ 'content' ].val();
1335
-
1336
- } else {
1337
- text = WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ].getContent( { format: 'raw' } );
1338
- }
1339
-
1340
- count = WPGlobusCoreData.wordCounter[ l ][ 'counter' ].count( text );
1341
-
1342
- if ( count !== WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] ) {
1343
- WPGlobusCoreData.wordCounter[ l ][ 'count' ].text( count );
1344
- }
1345
-
1346
- WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] = count;
1347
- }
1348
-
1349
- $(document).on( 'tinymce-editor-init', function( event, editor ) {
1350
-
1351
- if ( -1 == $.inArray(editor.id, wpglobusEditors) ) {
1352
- /**
1353
- * Init WPGlobus editor only.
1354
- */
1355
- return;
1356
- }
1357
- var l = editor.id.replace( 'content_', '' );
1358
-
1359
- WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ] = editor;
1360
-
1361
- editor.on( 'nodechange keyup', _.debounce( update, 1000 ) );
1362
- } );
1363
-
1364
- WPGlobusCoreData.wordCounter[l]['content'].on( 'input keyup', _.debounce( update, 1000 ) );
1365
-
1366
- update( l );
1367
-
1368
- } );
1369
- } )( jQuery, new wp.utils.WordCounter(), l );
1370
- });
1371
-
1372
- }
1373
-
1374
- $(document).on('click', '#publish, #save-post', function() {
1375
- if ( WPGlobusAdmin.data.open_languages.length > 1 ) {
1376
- $(document).triggerHandler('wpglobus_before_save_post', {content_tabs_id:content_tabs_id});
1377
- /**
1378
- * If empty title in default language make it from another titles.
1379
- */
1380
- var t = $('#title').val(),
1381
- index, title = '', delimiter = '';
1382
-
1383
- if ( t.length == 0 ) {
1384
- index = WPGlobusAdmin.data.open_languages.indexOf(WPGlobusAdmin.data.default_language);
1385
- WPGlobusAdmin.data.open_languages.splice(index, 1);
1386
- $(WPGlobusAdmin.data.open_languages).each(function(i,l){
1387
- delimiter = i == 0 ? '' : '-';
1388
- t = $('#title_'+l).val();
1389
- if ( t.length > 0 ) {
1390
- if ( title.length == 0 ) { delimiter = '';}
1391
- title = title + delimiter + t;
1392
- }
1393
- });
1394
- }
1395
- if ( title.length > 0 ) {
1396
- $('#title').val(title);
1397
- }
1398
- }
1399
-
1400
- /**
1401
- * To handle taxonomy tags.
1402
- */
1403
- if ( 'undefined' === typeof WPGlobusAdmin.data.tagsdiv || WPGlobusAdmin.data.tagsdiv.length < 1 ) {
1404
- return;
1405
- }
1406
- $(WPGlobusAdmin.data.tagsdiv).each(function(i,tagsdiv){
1407
- if ($('#' + tagsdiv).length == 0) {
1408
- /**
1409
- * Next iteration.
1410
- */
1411
- return true;
1412
- }
1413
-
1414
- var id = tagsdiv.replace('tagsdiv-', '');
1415
- if ( 'undefined' === id ) {
1416
- return true;
1417
- }
1418
- if ( $('#tax-input-'+id).length == 0 ) {
1419
- return true;
1420
- }
1421
-
1422
- var name, tags = [];
1423
-
1424
- $('#tagsdiv-'+id+' .tagchecklist > span').each(function(i,e){
1425
- name = $(e).html();
1426
- name = name.replace( /<button.*<\/button>&nbsp;/, '' );
1427
- if ( 'undefined' === typeof WPGlobusAdmin.data.tag[id][name] ) {
1428
- tags[i] = name;
1429
- } else {
1430
- tags[i] = WPGlobusAdmin.data.tag[id][name];
1431
- }
1432
- });
1433
-
1434
- $('#tax-input-'+id).val(tags.join(', '));
1435
- });
1436
- /**
1437
- * The end to handle taxonomy tags.
1438
- */
1439
- });
1440
-
1441
- /**
1442
- * The alignment when default tab was clicked.
1443
- */
1444
- $('.ui-state-default').on('click', function () {
1445
- if ('link-tab-default' === $(this).attr('id')) {
1446
- $(window).scrollTop($(window).scrollTop() + 1);
1447
- $(window).scrollTop($(window).scrollTop() - 1);
1448
- }
1449
- });
1450
-
1451
- /**
1452
- * Set current value after language tab of content was changed.
1453
- */
1454
- $(document).on( 'tabsactivate', content_tabs_id, function( event, ui ) {
1455
- WPGlobusAdmin.currentTab = ui.newTab[0].dataset.language;
1456
- });
1457
-
1458
- $(document).triggerHandler('wpglobus_after_post_edit');
1459
-
1460
- },
1461
- adminCentral: function () {
1462
- $( '.wpglobus-admin-central-tab' ).css({ 'display':'none' });
1463
-
1464
- if ( $( '.nav-tab-active' ).length > 1 ) {
1465
- $( '.wpglobus-about-wrap .nav-tab-wrapper a' ).removeClass( 'nav-tab-active' );
1466
- }
1467
-
1468
- var setFirstElement = true;
1469
- if ( 0 == location.hash.indexOf( '#' ) ) {
1470
- $( '.wpglobus-about-wrap .nav-tab-wrapper a').each( function( i, e ) {
1471
- if ( $(e).attr( 'href' ) == location.hash ) {
1472
- setFirstElement = false;
1473
- $(e).addClass( 'nav-tab-active' );
1474
- }
1475
- });
1476
- }
1477
- if ( setFirstElement ) {
1478
- $( '.wpglobus-about-wrap .nav-tab-wrapper a' ).eq(0).addClass( 'nav-tab-active' );
1479
- }
1480
-
1481
- var activePanel = $( '.wpglobus-about-wrap .nav-tab-active' ).data( 'tab-id' );
1482
- if ( '' != activePanel ) {
1483
- $( '#'+activePanel ).css({'display':'block'});
1484
- }
1485
-
1486
- $(document).on( 'click', '.wpglobus-about-wrap .nav-tab', function(event){
1487
- var $t = $( this );
1488
- if ( $t.hasClass( 'nav-tab-active' ) ) {
1489
- return;
1490
- }
1491
- $( '.wpglobus-admin-central-tab' ).css({ 'display':'none' });
1492
- $( '.wpglobus-about-wrap .nav-tab' ).removeClass( 'nav-tab-active' );
1493
- $t.addClass( 'nav-tab-active' );
1494
- if ( '' != $t.data( 'tab-id' ) ) {
1495
- $( '#' + $t.data( 'tab-id' ) ).css({ 'display':'block' });
1496
- }
1497
- });
1498
- },
1499
- start: function () {
1500
- var t = this;
1501
- $('#wpglobus_flags').select2({
1502
- formatResult: this.format,
1503
- formatSelection: this.format,
1504
- minimumResultsForSearch: -1,
1505
- escapeMarkup: function (m) {
1506
- return m;
1507
- }
1508
- });
1509
-
1510
- /** disable checked off first language */
1511
- $('body').on('click', '#enabled_languages-list li:first input', function (event) {
1512
- event.preventDefault();
1513
- $('.redux-save-warn').css({'display': 'none'});
1514
- $('#enabled_languages-list').find('li:first > input').val('1');
1515
- if ($('#disable_first_language').length === 0) {
1516
- $(t.config.disable_first_language).insertAfter('#info_bar');
1517
- }
1518
- return false;
1519
- });
1520
-
1521
- },
1522
- format: function (language) {
1523
- return '<img class="wpglobus_flag" src="' + WPGlobusAdmin.flag_url + language.text + '"/>&nbsp;&nbsp;' + language.text;
1524
- },
1525
- set_dialog: function() {
1526
-
1527
- if ( 'undefined' !== typeof WPGlobusAdmin.data.customFieldsEnabled ) {
1528
- WPGlobusAdmin.data.customFieldsEnabled = this.parseBool( WPGlobusAdmin.data.customFieldsEnabled );
1529
- if ( ! WPGlobusAdmin.data.customFieldsEnabled ) {
1530
- return;
1531
- }
1532
- }
1533
-
1534
- var ajaxify_row_id, added_control = false;
1535
- var add_elements = function(post_id) {
1536
-
1537
- var id, rows, cb, _cb,
1538
- _classes = 'wpglobus_dialog_start wpglobus_dialog_icon';
1539
-
1540
- _cb = [
1541
- '<div class="wpglobus_dialog_options_wrapper hidden">',
1542
- '<input style="width:initial;" id="wpglobus-cb-{{id}}" data-object="#wpglobus-dialog-start-{{id}}" data-meta-key="{{meta-key}}" class="wpglobus_dialog_option wpglobus_dialog_cb" type="checkbox" {{checked}} />',
1543
- '</div>'
1544
- ].join('');
1545
-
1546
- if (typeof post_id == 'undefined') {
1547
- rows = '#the-list tr';
1548
- } else {
1549
- rows = '#the-list tr#'+post_id;
1550
- }
1551
- $(rows).each(function(){
1552
- var $t = $(this),
1553
- tid = $t.attr('id'),
1554
- element = $t.find('textarea'),
1555
- clone, name, meta_key,
1556
- classes = _classes;
1557
-
1558
- id = element.attr('id');
1559
- if ( undefined === id ) {
1560
- return true;
1561
- }
1562
- meta_key = $('#'+tid+'-key').val();
1563
- clone = $('#'+id).clone();
1564
- $(element).addClass('wpglobus-dialog-field-source hidden');
1565
- name = element.attr('name');
1566
- $(clone).attr('id', 'wpglobus-'+id);
1567
- $(clone).attr('name', 'wpglobus-'+name);
1568
- $(clone).attr('data-source-id', id);
1569
- $(clone).attr('class', 'wpglobus-dialog-field');
1570
- $(clone).val( WPGlobusCore.TextFilter($(element).val(), WPGlobusCoreData.language) );
1571
- $(clone).insertAfter(element);
1572
- cb = _cb.replace(/{{id}}/g, id);
1573
- cb = cb.replace(/{{meta-key}}/g, meta_key);
1574
- if ( undefined === WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type] ) {
1575
- cb = cb.replace(/{{checked}}/, 'checked');
1576
- } else {
1577
- if ( undefined !== WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][meta_key] && WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][meta_key] == 'false' ) {
1578
- cb = cb.replace(/{{checked}}/, '');
1579
- classes = _classes+' wpglobus_dialog_start_hidden';
1580
- } else {
1581
- cb = cb.replace(/{{checked}}/, 'checked');
1582
- classes = _classes;
1583
- }
1584
- }
1585
- $t.append('<td style="width:20px;"><div id="wpglobus-dialog-start-'+id+'" data-type="control" data-source-type="textarea" data-source-id="'+id+'" class="'+classes+'"></div>'+cb+'</td>');
1586
- });
1587
- if ( ! added_control && $('#list-table .wpglobus_dialog_start').length > 0 ) {
1588
- $('#list-table thead tr').append('<th class="wpglobus-control-head"><div class="wpglobus_dialog_settings wpglobus_dialog_icon"></div></th>');
1589
- added_control = true;
1590
- }
1591
- }
1592
-
1593
- add_elements();
1594
-
1595
- $('body').on('change', '.wpglobus-dialog-field', function(){
1596
- var $t = $(this),
1597
- source_id = '#'+$t.data('source-id'),
1598
- source = '', s = '', new_value;
1599
-
1600
- if ( typeof source_id == 'undefined' ) {
1601
- return;
1602
- }
1603
- source = $(source_id).val();
1604
-
1605
- if ( ! /(\{:|\[:|<!--:)[a-z]{2}/.test(source) ) {
1606
- $(source_id).val($t.val());
1607
- } else {
1608
- $.each(WPGlobusCoreData.enabled_languages, function(i,l){
1609
- if ( l == WPGlobusCoreData.language ) {
1610
- new_value = $t.val();
1611
- } else {
1612
- new_value = WPGlobusCore.TextFilter(source,l,'RETURN_EMPTY');
1613
- }
1614
- if ( '' != new_value ) {
1615
- s = s + WPGlobusCore.addLocaleMarks(new_value,l);
1616
- }
1617
- });
1618
- $(source_id).val(s);
1619
- }
1620
-
1621
- });
1622
-
1623
- $(document).ajaxSend(function(event, jqxhr, settings){
1624
- if ( 'add-meta' == settings.action ) {
1625
- ajaxify_row_id = settings.element;
1626
- }
1627
- });
1628
- $(document).ajaxComplete(function(event, jqxhr, settings){
1629
- if ( 'add-meta' == settings.action && undefined !== jqxhr.responseXML ) {
1630
- if ( 'newmeta' == ajaxify_row_id ) {
1631
- add_elements('meta-'+$(jqxhr.responseXML.documentElement.outerHTML).find('meta').attr('id'));
1632
- } else {
1633
- add_elements(ajaxify_row_id);
1634
- }
1635
- }
1636
- });
1637
-
1638
- WPGlobusDialogApp.init({dialogTitle:'Edit meta'});
1639
-
1640
- }
1641
- };
1642
-
1643
- new WPGlobusAdminApp.App();
1644
-
1645
- return WPGlobusAdminApp;
1646
-
1647
- }(window.WPGlobusAdminApp || {}, jQuery));
1648
-
1649
- });
1
+ /**
2
+ * WPGlobus Administration Core, Dialog, Admin
3
+ * Interface JS functions
4
+ *
5
+ * @since 1.7.0
6
+ *
7
+ * @package WPGlobus
8
+ * @subpackage Administration
9
+ */
10
+ /*jslint browser: true*/
11
+ /*global jQuery, console, WPGlobusCore, WPGlobusDialogApp, WPGlobusAdmin, inlineEditPost */
12
+
13
+ var WPGlobusCore;
14
+
15
+ (function($) {
16
+ var api;
17
+ api = WPGlobusCore = {
18
+ strpos: function( haystack, needle, offset){
19
+ haystack = "" + haystack;
20
+ var i = haystack.indexOf( needle, offset );
21
+ return i >= 0 ? i : false;
22
+ },
23
+
24
+ TextFilter: function(text, language, return_in){
25
+ if ( typeof text == 'undefined' || '' === text ) { return text; }
26
+
27
+ var pos_start, pos_end, possible_delimiters = [], is_local_text_found = false;;
28
+
29
+ language = '' == language ? 'en' : language;
30
+ return_in = typeof return_in == 'undefined' || '' == return_in ? 'RETURN_IN_DEFAULT_LANGUAGE' : return_in;
31
+
32
+ possible_delimiters[0] = [];
33
+ possible_delimiters[0]['start'] = WPGlobusCoreData.locale_tag_start.replace('%s', language);
34
+ possible_delimiters[0]['end'] = WPGlobusCoreData.locale_tag_end;
35
+
36
+ possible_delimiters[1] = [];
37
+ possible_delimiters[1]['start'] = '<!--:'+language+'-->';
38
+ possible_delimiters[1]['end'] = '<!--:-->';
39
+
40
+ possible_delimiters[2] = [];
41
+ possible_delimiters[2]['start'] = '[:'+language+']';
42
+ possible_delimiters[2]['end'] = '[:';
43
+
44
+
45
+
46
+ for (var i = 0; i < 3; i++) {
47
+
48
+ pos_start = api.strpos( text, possible_delimiters[i]['start'] );
49
+ if ( pos_start === false ) {
50
+ continue;
51
+ }
52
+
53
+ pos_start = pos_start + possible_delimiters[i]['start'].length;
54
+
55
+ pos_end = api.strpos( text, possible_delimiters[i]['end'], pos_start );
56
+
57
+ if ( pos_end === false ) {
58
+ text = text.substr( pos_start );
59
+ } else {
60
+ text = text.substr( pos_start, pos_end - pos_start );
61
+ }
62
+
63
+ is_local_text_found = true;
64
+ break;
65
+
66
+ }
67
+
68
+ if ( ! is_local_text_found ) {
69
+ if ( return_in == 'RETURN_EMPTY' ) {
70
+ if ( language == WPGlobusCoreData.default_language && ! /(\{:|\[:|<!--:)[a-z]{2}/.test(text) ) {
71
+ /** do nothing */
72
+ } else {
73
+ text = '';
74
+ }
75
+ } else {
76
+ /**
77
+ * Try RETURN_IN_DEFAULT_LANGUAGE.
78
+ */
79
+ if ( language == WPGlobusCoreData.default_language ) {
80
+ if ( /(\{:|\[:|<!--:)[a-z]{2}/.test(text) ) {
81
+ text = '';
82
+ }
83
+ } else {
84
+ text = api.TextFilter( text, WPGlobusCoreData.default_language );
85
+ }
86
+ }
87
+ }
88
+ return text;
89
+ },
90
+ addLocaleMarks: function(text, language) {
91
+ return WPGlobusCoreData.locale_tag_start.replace('%s', language) + text + WPGlobusCoreData.locale_tag_end;
92
+ },
93
+ getTranslations: function(text) {
94
+ var t = {},
95
+ return_in;
96
+ $.each(WPGlobusCoreData.enabled_languages, function(i,l){
97
+ return_in = l == WPGlobusCoreData.default_language ? 'RETURN_IN_DEFAULT_LANGUAGE' : 'RETURN_EMPTY';
98
+ t[l] = api.TextFilter(text, l, return_in);
99
+ });
100
+ return t;
101
+ },
102
+ getString: function(s, newVal, l) {
103
+ if ( 'undefined' === typeof(s) ) {
104
+ return s;
105
+ }
106
+ if ( 'undefined' === typeof(newVal) ) {
107
+ newVal = '';
108
+ }
109
+ if ( 'undefined' === typeof(l) ) {
110
+ l = WPGlobusCoreData.language;
111
+ }
112
+
113
+ s = api.getTranslations(s);
114
+ s[l] = newVal;
115
+
116
+ var cS = '';
117
+
118
+ $.each(s, function(ln,val){
119
+ if ( '' != val && ln != WPGlobusCoreData.default_language) {
120
+ cS += api.addLocaleMarks(val, ln);
121
+ }
122
+ });
123
+
124
+ if ( '' != s[WPGlobusCoreData.default_language] ) {
125
+ if ( '' == cS ) {
126
+ cS = s[WPGlobusCoreData.default_language];
127
+ } else {
128
+ cS = api.addLocaleMarks(s[WPGlobusCoreData.default_language], WPGlobusCoreData.default_language) + cS;
129
+ }
130
+ }
131
+ return cS;
132
+ }
133
+ };
134
+ })(jQuery);
135
+
136
+ var WPGlobusDialogApp;
137
+
138
+ (function($) {
139
+
140
+ var api;
141
+ api = WPGlobusDialogApp = {
142
+ option : {
143
+ listenClass : '.wpglobus_dialog_start',
144
+ settingsClass : '.wpglobus_dialog_settings',
145
+ dialogTabs: '#wpglobus-dialog-tabs',
146
+ dialogTitle: '',
147
+ customData: null,
148
+ callback: function(){},
149
+ dialogOptions: {
150
+ title: '',
151
+ placeholder: '',
152
+ formFooter: '',
153
+ beforeOpen: function(){},
154
+ close: function(){},
155
+ },
156
+ dialog: {}
157
+ },
158
+ form : undefined,
159
+ element : undefined,
160
+ element_by : 'id',
161
+ id : '',
162
+ clone_id: '',
163
+ wpglobus_id : '',
164
+ type : 'textarea',
165
+ source : '',
166
+ order : {},
167
+ value : {},
168
+ request : 'core',
169
+ attrs: {},
170
+ dialogTitle: '',
171
+ trClass: 'wpglobus-translatable',
172
+ startButton: [
173
+ '<span id="wpglobus-dialog-start-{{clone_id}}" ',
174
+ 'style="{{style}}" ',
175
+ 'data-type="control" data-dialog-title="{{title}}" ',
176
+ 'data-source-type="" data-source-id="{{id}}" data-source-name="{{name}}" ',
177
+ 'data-nodename="{{nodename}}"',
178
+ '{{sbTitle}} ',
179
+ 'class="{{classes}}"></span>'
180
+ ].join(''),
181
+ startButtonClass : 'wpglobus_dialog_start wpglobus_dialog_icon',
182
+ clicks: 0,
183
+ init: function(args) {
184
+ api.option.dialog = api.option.dialogOptions;
185
+ api.option = $.extend(api.option, args);
186
+ $(api.option.dialogTabs).tabs();
187
+ api.dialogTitle = api.option.dialogTitle;
188
+ this.attachListener();
189
+ if ( api.option.customData != null && typeof api.option.customData.addElements != 'undefined' ) {
190
+ $.each(api.option.customData.addElements, function(i,e) {
191
+ api.addElement(e);
192
+ });
193
+ }
194
+ },
195
+ convertToId: function(s){
196
+ s = s.replace(/\]/g,'');
197
+ s = s.replace(/\[/g,'-');
198
+ return s;
199
+ },
200
+ addElement: function(elem) {
201
+ var option = {
202
+ id: null,
203
+ style: '',
204
+ styleTextareaWrapper: '',
205
+ sbTitle: '',
206
+ onChangeClass: '',
207
+ dialogTitle: '',
208
+ dialog: api.option.dialogOptions
209
+ }
210
+ if ( 'string' == typeof(elem) ) {
211
+ option.id = elem;
212
+ } else if ( 'object' == typeof(elem) ) {
213
+ option = $.extend(option, elem);
214
+ } else {
215
+ return;
216
+ }
217
+
218
+ var $element = null, id = null, name = null, node = null,
219
+ sb = api.startButton,
220
+ clone, v, style, nodeName = '';
221
+
222
+ api.element_by = 'name';
223
+ node = document.getElementsByName(option.id);
224
+
225
+ if ( 0 == node.length ) {
226
+ api.element_by = 'id';
227
+ node = document.getElementById(option.id);
228
+ }
229
+
230
+ if ( null === node ) {
231
+ return;
232
+ } else {
233
+ id = option.id;
234
+ if ( 'id' == api.element_by ) {
235
+ $element = $('#'+id);
236
+ } else {
237
+ nodeName = node[0].nodeName;
238
+ nodeName = nodeName.toLowerCase();
239
+ $element = $(nodeName+'[name="'+id+'"]');
240
+ }
241
+ }
242
+
243
+ if ( 'undefined' === typeof $element.attr('name') || '' == $element.attr('name') ) {
244
+ name = id;
245
+ } else {
246
+ name = $element.attr('name');
247
+ }
248
+ api.clone_id = api.convertToId(id);
249
+
250
+ if ( -1 != name.indexOf( 'wpglobus' ) || -1 != api.clone_id.indexOf( 'wpglobus' ) ) {
251
+ /**
252
+ * To prevent add element to itself.
253
+ */
254
+ return false;
255
+ }
256
+
257
+ if ( $( '#wpglobus-'+api.clone_id ).length > 0 ) {
258
+ /**
259
+ * WPGlobus element exists already.
260
+ */
261
+ return false;
262
+ }
263
+ if ( $( nodeName+'[name="wpglobus-'+name+'"]' ).length > 0 ) {
264
+ /**
265
+ * WPGlobus element exists already.
266
+ */
267
+ return false;
268
+ }
269
+
270
+ clone = $( $element.clone() );
271
+ //$element.addClass('hidden');
272
+ style = $element.attr('style') || '';
273
+ $element.attr( 'style', 'display:none;' );
274
+ clone.attr( 'id', 'wpglobus-'+api.clone_id ).attr( 'name', 'wpglobus-'+name );
275
+
276
+ /**
277
+ * Add WPGlobus translatable class.
278
+ */
279
+ clone.addClass( api.trClass );
280
+
281
+ if ( option.onChangeClass != '' ) {
282
+ /**
283
+ * add class to bind 'change' event
284
+ */
285
+ clone.addClass( option.onChangeClass );
286
+ }
287
+
288
+ if ( 'id' == api.element_by ) {
289
+ clone.attr('data-source-id', id).attr('data-source-name', '').attr('data-source-get-by',api.element_by);
290
+ } else {
291
+ clone.attr('data-source-id', '').attr('data-source-name', name).attr('data-source-get-by',api.element_by);
292
+ }
293
+
294
+ if ( 'textarea' == nodeName ) {
295
+ v = WPGlobusCore.getTranslations( $element.val() )[WPGlobusCoreData['language']];
296
+ clone.val( v );
297
+ clone.attr( 'data-nodename', 'textarea' );
298
+ if ( '' == option.style ) {
299
+ clone.attr( 'style', style + ';width:95%;float:left;' );
300
+ } else {
301
+ clone.attr( 'style', style + ';' + option.style );
302
+ }
303
+ } else {
304
+ v = WPGlobusCore.getTranslations( $element.val() )[WPGlobusCoreData['language']];
305
+ clone.attr( 'value', v );
306
+ clone.attr( 'data-nodename', 'input' );
307
+ if ( '' != option.style ) {
308
+ clone.attr( 'style', style + ';' + option.style );
309
+ }
310
+ }
311
+
312
+ /**
313
+ * Add dialog options.
314
+ * @since 1.7.12
315
+ */
316
+ if ( '' != option.dialog ) {
317
+ clone.attr( 'data-dialog', JSON.stringify(option.dialog) );
318
+ }
319
+
320
+ sb = sb.replace(/{{clone_id}}/g, api.clone_id);
321
+ if ( 'id' == api.element_by ) {
322
+ sb = sb.replace(/{{id}}/g, api.clone_id);
323
+ sb = sb.replace(/{{name}}/g, '');
324
+ sb = sb.replace(/{{nodename}}/g, '');
325
+ } else {
326
+ sb = sb.replace(/{{id}}/g, '');
327
+ sb = sb.replace(/{{name}}/g, name);
328
+ sb = sb.replace(/{{nodename}}/g, nodeName);
329
+ }
330
+ sb = 'textarea' == nodeName ? sb.replace( '{{style}}', 'float:left;margin-top:0;' ) : sb.replace( '{{style}}', '' );
331
+ var startButtonClasses = 'textarea' == nodeName ? api.startButtonClass + ' wpglobus-textarea wpglobus-textarea-'+api.clone_id : api.startButtonClass;
332
+ sb = sb.replace( '{{classes}}', startButtonClasses );
333
+ sb = option.dialogTitle == '' ? sb.replace('{{title}}', api.dialogTitle) : sb.replace('{{title}}', option.dialogTitle);
334
+ sb = option.sbTitle == '' ? sb.replace('{{sbTitle}}', option.sbTitle) : sb.replace('{{sbTitle}}', 'title="'+option.sbTitle+'"');
335
+
336
+ $(sb).insertAfter($element);
337
+ $(clone).insertAfter($element);
338
+
339
+ if ( 'textarea' == nodeName ) {
340
+ $('#wpglobus-'+api.clone_id).addClass( 'wpglobus-textarea-'+api.clone_id );
341
+ $('.wpglobus-textarea-'+api.clone_id).wrapAll( '<div class="wpglobus-textarea-wrapper" style="'+option.styleTextareaWrapper+'"></div>' );
342
+ }
343
+
344
+ /**
345
+ * Bind change event
346
+ */
347
+ var selector, ret = false;
348
+ if ( option.onChangeClass == '' ) {
349
+ selector = '#wpglobus-' + api.clone_id;
350
+ } else {
351
+ selector = '.' + option.onChangeClass;
352
+ var $events = $._data( $(document)[0], 'events' );
353
+ if( typeof $events === 'undefined' ){
354
+ ret = true;
355
+ } else {
356
+ if ( typeof $events.change !== 'undefined' ) {
357
+ $.each( $events.change, function(i, ev){
358
+ if ( ev.selector == selector ) {
359
+ ret = true;
360
+ return false;
361
+ }
362
+ });
363
+ }
364
+ }
365
+ }
366
+
367
+ if ( ret ) {
368
+ /**
369
+ * Return because we had bound 'change' event already.
370
+ */
371
+ return true;
372
+ }
373
+
374
+ $(document).on( 'change', selector, function() {
375
+ var $t = $(this),
376
+ sid = $t.data( 'source-id' );
377
+
378
+ if ( '' == sid ) {
379
+ sid = $t.data( 'nodename' ) + '[name="' + $t.data( 'source-name' ) + '"]';
380
+ } else {
381
+ sid = '#' + sid;
382
+ }
383
+ $(sid).val( WPGlobusCore.getString( $(sid).val(), $t.val() ) );
384
+ });
385
+ return true;
386
+ },
387
+ saveDialog: function() {
388
+ var s = '', sdl = '', scl = '', $e, val, l;
389
+ $('.wpglobus_dialog_textarea').each(function(indx,e){
390
+ $e = $(e);
391
+ val = $e.val();
392
+ l = $e.data('language');
393
+ if ( l == WPGlobusAdmin.data.language ) {
394
+ scl = val;
395
+ }
396
+ if ( val != '' ) {
397
+ s = s + WPGlobusCore.addLocaleMarks(val,l);
398
+ if ( l == WPGlobusCoreData.default_language ) {
399
+ sdl = val;
400
+ }
401
+ }
402
+ });
403
+ s = s.length == sdl.length + 8 ? sdl : s;
404
+ $(api.id).val(s);
405
+ s = scl == '' ? sdl : scl;
406
+ $(api.wpglobus_id).val(s);
407
+ },
408
+ dialog : $('#wpglobus-dialog-wrapper').dialog({
409
+ autoOpen: false,
410
+ //height: 250,
411
+ width: 650,
412
+ modal: true,
413
+ dialogClass: 'wpglobus-dialog',
414
+ buttons: [
415
+ {
416
+ text:'Save',
417
+ class: 'wpglobus-button-save',
418
+ click:function(){api.saveDialog(); api.dialog.dialog('close');}
419
+ },
420
+ {
421
+ text:'Cancel',
422
+ class: 'wpglobus-button-cancel',
423
+ click: function(){api.dialog.dialog('close');}
424
+ }
425
+ ],
426
+ open: function( event, ui ) {
427
+ var title = api.dialogTitle;
428
+ if ( typeof api.attrs.maxlength !== 'undefined' ) {
429
+ $('.wpglobus_dialog_textarea').attr('maxlength', api.attrs.maxlength);
430
+ title += ' | maxlength='+api.attrs.maxlength;
431
+ }
432
+ $('.wpglobus-dialog .ui-dialog-title').text(title);
433
+ },
434
+ close: function() {
435
+ /**
436
+ * Close callback.
437
+ */
438
+ api.runCallback( api.option.dialog.close );
439
+
440
+ api.form[0].reset();
441
+ //allFields.removeClass( "ui-state-error" );
442
+ }
443
+ }),
444
+ attachListener : function() {
445
+ $(document).on('click', api.option.settingsClass, function() {
446
+ if ( $('.wpglobus_dialog_options_wrapper').hasClass('hidden') ) {
447
+ $('.wpglobus_dialog_options_wrapper').removeClass('hidden');
448
+ } else {
449
+ $('.wpglobus_dialog_options_wrapper').addClass('hidden');
450
+ }
451
+ });
452
+ $(document).on('click', '.wpglobus_dialog_option', function(event) {
453
+ var $t = $(this), r;
454
+ var ob = $t.data('object');
455
+ api.order['action'] = 'save_post_meta_settings';
456
+ api.order['post_type'] = WPGlobusAdmin.data.post_type;
457
+ api.order['checked'] = $t.prop('checked');
458
+ api.order['id'] = $t.attr('id');
459
+ api.order['meta_key'] = $t.data('meta-key');
460
+ r = api.ajax(api.order);
461
+ r.done(function (result) {
462
+ if ( result.result == 'ok' ) {
463
+ if ( result.checked == 'true' ) {
464
+ $(ob).removeClass('wpglobus_dialog_start_hidden');
465
+ } else {
466
+ $(ob).addClass('wpglobus_dialog_start_hidden');
467
+ }
468
+ }
469
+ })
470
+ .fail(function (error) {})
471
+ .always(function (jqXHR, status){});
472
+ });
473
+ $(document).on('click', api.option.listenClass, function(e) {
474
+ api.element = $(this);
475
+ api.id = api.element.data('source-id');
476
+ if ( '' == api.id ) {
477
+ api.id = api.element.data('nodename') + '[name="'+api.element.data('source-name')+'"]';
478
+ api.wpglobus_id = '#wpglobus-'+api.convertToId( api.element.data('source-name') );
479
+ } else {
480
+ api.wpglobus_id = '#wpglobus-'+api.id;
481
+ api.id = '#'+api.id;
482
+ }
483
+
484
+ api.clicks++;
485
+ if ( api.clicks == 1 ) {
486
+ setTimeout(function () {
487
+ if (api.clicks == 1) {
488
+ api.onClick(e);
489
+ } else {
490
+ var s = $(api.id);
491
+ if ( s.hasClass('hidden') ) {
492
+ s.removeClass('hidden').attr('style', 'display:block;');
493
+ } else {
494
+ s.addClass('hidden').attr('style', 'display:none;');
495
+ }
496
+ }
497
+ api.clicks = 0;
498
+ }, 200);
499
+ }
500
+ });
501
+ api.form = api.dialog.find('form#wpglobus-dialog-form').on('submit', function( event ) {
502
+ event.preventDefault();
503
+ api.saveDialog();
504
+ });
505
+ },
506
+ ajax : function(order) {
507
+ return $.ajax({type:'POST', url:WPGlobusAdmin.ajaxurl, data:{action:WPGlobusAdmin.process_ajax, order:order}, dataType:'json', async:false});
508
+ },
509
+ onClick: function(ev) {
510
+ if ( typeof(api.element.data('dialog-title')) == 'undefined' || '' == api.element.data('dialog-title') ) {
511
+ api.dialogTitle = api.option.dialogTitle;
512
+ } else {
513
+ api.dialogTitle = api.element.data('dialog-title');
514
+ }
515
+ if ( typeof api.id !== 'undefined' ) {
516
+ api.attrs['maxlength'] = $(api.id).attr('maxlength');
517
+ }
518
+
519
+ api.source = api.element.data('source-value');
520
+ if ( typeof api.source === 'undefined' ) {
521
+ api.source = $(api.id).val();
522
+ if (api.request == 'ajax') {
523
+ // @todo revise ajax action
524
+ //api.order['action'] = 'get_translate';
525
+ //api.order['source'] = api.source;
526
+ //api.ajax(api.order);
527
+ } else {
528
+ api.value = WPGlobusCore.getTranslations(api.source);
529
+ }
530
+ }
531
+
532
+ /**
533
+ * Get dialog form options.
534
+ */
535
+ api.option.dialog = $.extend( {}, api.option.dialogOptions, $(api.wpglobus_id).data('dialog') );
536
+
537
+ if ( '' != api.option.dialog.title ) {
538
+ api.dialogTitle = api.option.dialog.title;
539
+ }
540
+
541
+ $.each(api.value, function(l,e){
542
+ var $d = $('#wpglobus-dialog-'+l);
543
+ /**
544
+ * Value.
545
+ */
546
+ $d.val(e);
547
+
548
+ /**
549
+ * Placeholder.
550
+ */
551
+ $d.attr(
552
+ 'placeholder',
553
+ WPGlobusCore.TextFilter( api.option.dialog.placeholder, l, 'RETURN_IN_DEFAULT_LANGUAGE' )
554
+ );
555
+ });
556
+
557
+ /**
558
+ * Dialog form footer.
559
+ */
560
+ $('#wpglobus-dialog-form-footer').html(api.option.dialog.formFooter);
561
+
562
+ /**
563
+ * Before open callback.
564
+ */
565
+ api.runCallback( api.option.dialog.beforeOpen );
566
+
567
+ api.dialog.dialog('open');
568
+ },
569
+ runCallback: function(callback) {
570
+
571
+ if ( 'object' === typeof callback ) {
572
+ var k = Object.keys(callback)[0];
573
+ var fn = callback[Object.keys(callback)[0]]
574
+ if ( 'window' === k ) {
575
+ if ( 'function' === typeof window[fn] ) {
576
+ window[fn]( callback[Object.keys(callback)[1]] );
577
+ }
578
+ } else if ( 'function' === typeof window[k][fn] ) {
579
+ window[k][fn]( callback[Object.keys(callback)[1]] );
580
+ }
581
+ } else if ( 'string' === typeof callback ) {
582
+ if ( 'function' === typeof window[callback] ) {
583
+ window[callback]();
584
+ }
585
+ }
586
+
587
+ }
588
+ };
589
+
590
+ })(jQuery);
591
+
592
+ jQuery(document).ready(function () {
593
+ "use strict";
594
+ window.WPGlobusAdminApp = (function (WPGlobusAdminApp, $) {
595
+ /* Object Constructor
596
+ ========================*/
597
+ WPGlobusAdminApp.App = function (config) {
598
+
599
+ if ( 'undefined' !== typeof window.WPGlobusAdminApp ) {
600
+ return;
601
+ }
602
+
603
+ this.config = {
604
+ debug: false,
605
+ version: WPGlobusAdmin.version
606
+ };
607
+
608
+ this.status = 'ok';
609
+
610
+ if ( 'undefined' === typeof WPGlobusAdmin ) {
611
+ this.status = 'error';
612
+ if (this.config.debug) {
613
+ console.log('WPGlobus: error options loading');
614
+ }
615
+ } else {
616
+ if (this.config.debug) {
617
+ console.dir(WPGlobusAdmin);
618
+ }
619
+ }
620
+
621
+ this.config.disable_first_language = [
622
+ '<div id="disable_first_language" style="display:block;" class="redux-field-errors notice-red">',
623
+ '<strong>',
624
+ '<span>&nbsp;</span>',
625
+ WPGlobusAdmin.i18n.cannot_disable_language,
626
+ '</strong>',
627
+ '</div>'
628
+ ].join('');
629
+
630
+ $.extend(this.config, config);
631
+
632
+ if ('ok' === this.status) {
633
+ this.init();
634
+ }
635
+ };
636
+
637
+ WPGlobusAdminApp.App.prototype = {
638
+ $document : $(document),
639
+ init: function () {
640
+ WPGlobusCoreData.multisite = this.parseBool(WPGlobusCoreData.multisite);
641
+ this.adminInit();
642
+ $('#content').addClass('wpglobus-editor').attr('data-language',WPGlobusAdmin.data.default_language);
643
+ $('textarea[id^=content_]').each(function(i,e){
644
+ var l=$(e).attr('id').replace('content_','');
645
+ $(e).attr('data-language',l);
646
+ });
647
+ if ('post.php' === WPGlobusAdmin.page) {
648
+ this.postEdit();
649
+ this.set_dialog();
650
+ if ( 'undefined' !== typeof WPGlobusAioseop ) {
651
+ WPGlobusAioseop.init();
652
+ }
653
+ } else if ('menu-edit' === WPGlobusAdmin.page) {
654
+ this.navMenus();
655
+ } else if ('taxonomy-edit' === WPGlobusAdmin.page) {
656
+ if (WPGlobusAdmin.data.tag_id) {
657
+ this.taxonomyEdit();
658
+ }
659
+ } else if ('taxonomy-quick-edit' === WPGlobusAdmin.page) {
660
+ this.quickEdit('taxonomy');
661
+ } else if ('edit.php' === WPGlobusAdmin.page) {
662
+ this.quickEdit('post');
663
+ } else if ('options-general.php' == WPGlobusAdmin.page) {
664
+ this.optionsGeneral();
665
+ } else if ('widgets.php' == WPGlobusAdmin.page) {
666
+ WPGlobusWidgets.init();
667
+ WPGlobusDialogApp.init({dialogTitle:'Edit text'});
668
+ } else if ('wpglobus_options' == WPGlobusAdmin.page) {
669
+ this.start();
670
+ } else if ('wpglobusAdminCentral' == WPGlobusAdmin.page) {
671
+ this.adminCentral();
672
+ } else {
673
+ /**
674
+ * Init WPGlobusDialogApp for using in a 3-party plugins.
675
+ */
676
+ WPGlobusDialogApp.init({customData:WPGlobusCoreData.page_custom_data});
677
+ }
678
+ },
679
+ parseBool: function(b) {
680
+ return !(/^(false|0)$/i).test(b) && !!b;
681
+ },
682
+ getCurrentTab: function() {
683
+ return $( '.wpglobus-post-body-tabs-list .ui-tabs-active' ).data( 'language' );
684
+ },
685
+ adminInit: function () {
686
+ var order = $('.wpglobus-addons-group a').data('key');
687
+ if ( 'undefined' !== typeof order ) {
688
+ if ( window.location.search.indexOf('page=wpglobus_options&tab='+order) >= 0 ) {
689
+ if ( WPGlobusCoreData.multisite ) {
690
+ window.location = WPGlobusCoreData.pluginInstallLocation.multisite;
691
+ } else {
692
+ window.location = WPGlobusCoreData.pluginInstallLocation.single;
693
+ }
694
+ } else {
695
+ var addon = $('#toplevel_page_wpglobus_options li').eq(order+1);
696
+ if ( WPGlobusCoreData.multisite ) {
697
+ $(addon).find('a').attr('href',WPGlobusCoreData.pluginInstallLocation.multisite).attr('onclick',"window.location=jQuery(this).attr('href');return false;");
698
+ } else {
699
+ $(addon).find('a').attr('href',WPGlobusCoreData.pluginInstallLocation.single).attr('onclick',"window.location=jQuery(this).attr('href');return false;");
700
+ }
701
+ }
702
+ }
703
+ },
704
+ optionsGeneral: function() {
705
+ var $bn = $('#blogname'),
706
+ $body = $('body');
707
+
708
+ $bn.addClass('hidden');
709
+ $('#wpglobus-blogname').insertAfter($bn).removeClass('hidden');
710
+
711
+ $body.on('blur', '.wpglobus-blogname', function () {
712
+ $('.wpglobus-blogname').each( function (i, e) {
713
+ var $e = $(e);
714
+ $bn.val( WPGlobusCore.getString( $bn.val(), $e.val(), $e.data('language') ) );
715
+ });
716
+ });
717
+
718
+ var $bd = $('#blogdescription');
719
+ $bd.addClass('hidden');
720
+ $('#wpglobus-blogdescription').insertAfter($bd).removeClass('hidden');
721
+ $body.on('blur', '.wpglobus-blogdesc', function () {
722
+ $('.wpglobus-blogdesc').each( function (i, e) {
723
+ var $e = $(e);
724
+ $bd.val( WPGlobusCore.getString( $bd.val(), $e.val(), $e.data('language') ) );
725
+ });
726
+ });
727
+ },
728
+ quickEdit: function(type) {
729
+ /**
730
+ * For more info @see ajax handler 'wp_ajax_inline_save'.
731
+ */
732
+ if ( 'undefined' === typeof WPGlobusAdmin.data.has_items ) {
733
+ return;
734
+ }
735
+ if (!WPGlobusAdmin.data.has_items) {
736
+ return;
737
+ }
738
+ var full_id = '', id = 0;
739
+
740
+ $(document).ajaxComplete(function(event, jqxhr, settings){
741
+ if (typeof settings.data === 'undefined') {
742
+ return;
743
+ }
744
+ if ( full_id == '' ) {
745
+ return;
746
+ }
747
+ if (settings.data.indexOf('action=inline-save-tax&') >= 0) {
748
+ $('#'+full_id+' a.row-title').text(WPGlobusAdmin.qedit_titles[id][WPGlobusAdmin.data.language]['name']);
749
+ $('#'+full_id+' .description').text(WPGlobusAdmin.qedit_titles[id][WPGlobusAdmin.data.language]['description']);
750
+ }
751
+ });
752
+
753
+ var title = {};
754
+ $('#the-list tr').each(function (i, e) {
755
+ var $e = $(e);
756
+ var k = ( type === 'post' ? 'post-' : 'tag-' );
757
+ id = $e.attr('id').replace(k, ''); /* don't need var with id, see line 109 */
758
+ title[id] = {};
759
+ if ('post' === type) {
760
+ title[id]['source'] = $e.find('.post_title').text();
761
+ } else if ('taxonomy' === type) {
762
+ title[id]['source'] = $('#inline_' + id + ' .name').text();
763
+ }
764
+ });
765
+
766
+ var order = {};
767
+ order['action'] = 'get_titles';
768
+ order['type'] = type;
769
+ order['taxonomy'] = typeof WPGlobusAdmin.data.taxonomy === 'undefined' ? false : WPGlobusAdmin.data.taxonomy;
770
+ order['title'] = title;
771
+ $.ajax({type:'POST', url:WPGlobusAdmin.ajaxurl, data:{action:WPGlobusAdmin.process_ajax, order:order}, dataType:'json'})
772
+ .done(function (result) {
773
+ WPGlobusAdmin.qedit_titles = result.qedit_titles;
774
+ $.each(result.bulkedit_post_titles, function(id, obj){
775
+ $('#inline_'+id+' .post_title').text(obj[WPGlobusAdmin.data.language]['name']);
776
+ });
777
+ })
778
+ .fail(function (error) {
779
+ })
780
+ .always(function (jqXHR, status) {
781
+ });
782
+
783
+ $('body').on('change', '.wpglobus-quick-edit-title', function () {
784
+ var s = '';
785
+ var lang = [];
786
+ $('.wpglobus-quick-edit-title').each(function (index, e) {
787
+ var $e = $(e);
788
+ var l = $e.data('language');
789
+ if ($e.val() !== '') {
790
+ s = WPGlobusCore.getString( s, $e.val(), l );
791
+ }
792
+ WPGlobusAdmin.qedit_titles[ id ][ l ][ 'name' ] = $e.val();
793
+ lang[ index ] = l;
794
+ });
795
+
796
+ var so = $(document).triggerHandler( 'wpglobus_get_translations', {string:s, lang:lang, id:id} );
797
+ if ( typeof so !== 'undefined' ) {
798
+ s = so;
799
+ }
800
+ $( 'input.ptitle' ).eq( 0 ).attr( 'value', s ) ;
801
+ WPGlobusAdmin.qedit_titles[ id ][ 'source' ] = s;
802
+ });
803
+
804
+ if ( typeof WPGlobusAdmin.data.tags !== 'undefined' ) {
805
+ $.each( WPGlobusAdmin.data.tags, function(i,tag){
806
+ WPGlobusAdmin.data.value[tag]['post_id'] = {};
807
+ });
808
+ }
809
+
810
+ $('button.save, input#bulk_edit').on('mouseenter', function (event) {
811
+ /**
812
+ * Quick edit action for the "Tags" box in edit.php page.
813
+ */
814
+ if ( typeof WPGlobusAdmin.data.tags === 'undefined' ) {
815
+ return;
816
+ }
817
+
818
+ if (event.currentTarget.id=='bulk_edit') {
819
+ $('input#bulk_edit').unbind('click');
820
+ } else {
821
+ $('button.save').unbind('click');
822
+ }
823
+
824
+ $( 'button.save, input#bulk_edit').on('click', function (event) {
825
+ //console.log( 'Start Updating' );
826
+ var promise = $.when();
827
+
828
+ var tagsHandler = function( $elem ) {
829
+ $elem.next('.spinner').css({'visibility':'visible'});
830
+ if (event.currentTarget.id != 'bulk_edit') {
831
+ $.ajaxSetup({async:false});
832
+ }
833
+ var p = $elem.parents('tr');
834
+ var id = p.attr('id').replace('edit-','');
835
+ var t,v,newTags;
836
+
837
+ $.each( WPGlobusAdmin.data.tags, function(index,tag){
838
+ t = p.find("textarea[name='" + WPGlobusAdmin.data.names[tag] + "']");
839
+ if ( t.length == 0 ) {
840
+ return true;
841
+ }
842
+ WPGlobusAdmin.data.value[tag]['post_id'][id] = t.val();
843
+ v = WPGlobusAdmin.data.value[tag]['post_id'][id].split(',');
844
+ newTags = [];
845
+ for(var i=0; i<v.length; i++) {
846
+ v[i] = v[i].trim(' ');
847
+ if ( v[i] != '' ) {
848
+ if ( typeof WPGlobusAdmin.data.tag[tag][v[i]] === 'undefined' ) {
849
+ newTags[i] = v[i];
850
+ } else {
851
+ newTags[i] = WPGlobusAdmin.data.tag[tag][v[i]];
852
+ }
853
+ }
854
+ }
855
+ t.val( newTags.join(', ') );
856
+ });
857
+ }
858
+
859
+ var $this = $(this);
860
+ var start = $.Deferred();
861
+ start.resolve( tagsHandler( $(this) ) );
862
+
863
+ promise = promise.then(function() {
864
+ return $.when(
865
+ start.done()
866
+ )
867
+ }).then( function() {
868
+ if (event.currentTarget.id != 'bulk_edit') {
869
+ setTimeout(
870
+ function() {
871
+ inlineEditPost.save(id);
872
+ $.ajaxSetup({async:true});
873
+ },
874
+ 50
875
+ );
876
+ }
877
+ });
878
+
879
+ });
880
+ });
881
+
882
+ $( '#the-list' ).on( 'click', 'a.editinline', function () {
883
+ var t = $(this);
884
+ full_id = t.parents('tr').attr('id');
885
+ if ('post' === type) {
886
+ id = full_id.replace('post-', '');
887
+ } else if ('taxonomy' === type) {
888
+ id = full_id.replace('tag-', '');
889
+ } else {
890
+ return;
891
+ }
892
+
893
+ if ( 'post' === type && 'undefined' !== typeof WPGlobusAdmin.data.tags ) {
894
+ /**
895
+ * @since 1.6.6
896
+ */
897
+ $.each( WPGlobusAdmin.data.tags, function(i,tag){
898
+ if ( WPGlobusAdmin.data.value[tag] != '' ) {
899
+ var val = $('#edit-' + id + ' textarea[name="' + WPGlobusAdmin.data.names[tag] + '"]').val(),
900
+ currentTags;
901
+ if ( 'undefined' !== typeof val ) {
902
+ currentTags = val.split(',');
903
+ $.each( currentTags, function(order,currentTag) {
904
+ val = val.replace(currentTag, WPGlobusCore.TextFilter(currentTag, WPGlobusCoreData.language));
905
+ });
906
+ $('#edit-' + id + ' textarea[name="' + WPGlobusAdmin.data.names[tag] + '"]').val(val);
907
+ }
908
+ }
909
+ });
910
+ }
911
+
912
+ var e = $('#edit-' + id + ' input.ptitle').eq(0);
913
+ var p = e.parents('label');
914
+ e.val(WPGlobusAdmin.qedit_titles[id].source);
915
+ e.addClass('hidden');
916
+ $(WPGlobusAdmin.data.template).insertAfter(p);
917
+
918
+ if ( typeof WPGlobusAdmin.qedit_titles[id] === 'undefined' ) {
919
+ WPGlobusAdmin.qedit_titles[id] = {};
920
+ WPGlobusAdmin.qedit_titles[id]['source'] = $('#'+full_id+' .name a.row-title').text();
921
+ $(WPGlobusAdmin.data.enabled_languages).each(function(i,l){
922
+ WPGlobusAdmin.qedit_titles[id][l] = {};
923
+ if ( l == WPGlobusAdmin.data.default_language ) {
924
+ WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id]['source'];
925
+ } else {
926
+ WPGlobusAdmin.qedit_titles[id][l]['name'] = '';
927
+ }
928
+ WPGlobusAdmin.qedit_titles[id][l]['description'] = '';
929
+ });
930
+ }
931
+
932
+ $( '.wpglobus-quick-edit-title' ).each(function ( i, e ) {
933
+ var $e = $(e);
934
+ var l = $e.data( 'language' );
935
+ $e.attr( 'id', l + id );
936
+ if ( typeof WPGlobusAdmin.qedit_titles[id][l] !== 'undefined' ) {
937
+ WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id][l]['name'].replace( /\\\'/g, "'" );
938
+ WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id][l]['name'].replace( /\\\"/g, '"' );
939
+ $e.attr( 'value', WPGlobusAdmin.qedit_titles[id][l]['name'] );
940
+ WPGlobusAdmin.qedit_titles[id]['source'] =
941
+ WPGlobusCore.getString(
942
+ WPGlobusAdmin.qedit_titles[id]['source'],
943
+ WPGlobusAdmin.qedit_titles[id][l]['name'],
944
+ l
945
+ );
946
+ }
947
+ });
948
+ $( 'input.ptitle' ).eq( 0 ).attr( 'value', WPGlobusAdmin.qedit_titles[ id ][ 'source' ] );
949
+ });
950
+
951
+ },
952
+ taxonomyEdit: function () {
953
+
954
+ var elements = [];
955
+ elements[0] = 'name';
956
+ elements[1] = 'description';
957
+
958
+ var make_clone = function(id,language){
959
+ var $element = $('#'+id),
960
+ clone = $element.clone(),
961
+ name = $element.attr('name'),
962
+ classes = 'wpglobus-element wpglobus-element_'+id+' wpglobus-element_'+language+' wpglobus-translatable',
963
+ node;
964
+
965
+ node = document.getElementById(id);
966
+ node = node.nodeName;
967
+ $(clone).attr('id', id+'_'+language);
968
+ $(clone).attr('name', name+'_'+language);
969
+ if ( language !== WPGlobusCoreData.default_language ) {
970
+ classes += ' hidden';
971
+ }
972
+ $(clone).attr('class', classes);
973
+ $(clone).attr('data-save-to', id);
974
+ $(clone).attr('data-language', language);
975
+ if ( node == 'INPUT' ) {
976
+ $(clone).attr('value', $('#wpglobus-link-tab-'+language).data(id));
977
+ } else if ( node == 'TEXTAREA' ) {
978
+ $(clone).text($('#wpglobus-link-tab-'+language).data(id));
979
+ }
980
+ $element.addClass('hidden');
981
+ if ( $('.wpglobus-element_'+id).length == 0 ) {
982
+ $(clone).insertAfter($element);
983
+ } else {
984
+ $(clone).insertAfter($('.wpglobus-element_'+id).last());
985
+ }
986
+ };
987
+
988
+ $.each(WPGlobusCoreData.enabled_languages, function(i,l){
989
+ $.each(elements, function(i,e){
990
+ make_clone(e,l);
991
+ });
992
+ });
993
+
994
+ $('.wpglobus-taxonomy-tabs').insertAfter('#ajax-response');
995
+
996
+ /**
997
+ * Make class wrap as tabs container.
998
+ * Tabs on.
999
+ */
1000
+ $('.wrap').tabs();
1001
+
1002
+ $('body').on('click', '.wpglobus-taxonomy-tabs li', function(event){
1003
+ var $t = $(this);
1004
+ var language = $t.data('language');
1005
+ $('.wpglobus-element').addClass('hidden');
1006
+ $('.wpglobus-element_'+language).removeClass('hidden');
1007
+ });
1008
+
1009
+ $('.wpglobus-element').on('change', function () {
1010
+ var $this = $(this),
1011
+ save_to = $this.data('save-to'),
1012
+ s = '';
1013
+
1014
+ $('.wpglobus-element').each(function (index, element) {
1015
+ var $e = $(element),
1016
+ value = $e.val();
1017
+ if ( $e.data('save-to') == save_to && value !== '' ) {
1018
+ s = s + WPGlobusCore.addLocaleMarks(value, $e.data('language') )
1019
+ }
1020
+ });
1021
+ $('#' + save_to).val(s);
1022
+ });
1023
+
1024
+ /**
1025
+ * @since 1.8.1
1026
+ * $('<span class="wpglobus-multilingual-slug wpglobus_dialog_start wpglobus_dialog_icon" title="Title"></span>').insertBefore('#slug');
1027
+ * $('.term-slug-wrap th').css({'padding-right':'0'});
1028
+ * $('.term-slug-wrap td').css({'padding-left':'0'});
1029
+ */
1030
+ $(WPGlobusAdmin.data.multilingualSlug.title).insertAfter('.term-slug-wrap th label');
1031
+
1032
+ },
1033
+ navMenus: function () {
1034
+ var iID, menu_size,
1035
+ menu_item = '#menu-to-edit .menu-item';
1036
+
1037
+ var timer = function () {
1038
+ if ( menu_size !== $(menu_item).length ) {
1039
+ clearInterval(iID);
1040
+ $(menu_item).each(function (index, li) {
1041
+ var $li = $(li);
1042
+ if ($li.hasClass('wpglobus-menu-item')) {
1043
+ return; /** the same as continue */
1044
+ }
1045
+ var id = $(li).attr('id');
1046
+ $.each(['input.edit-menu-item-title', 'input.edit-menu-item-attr-title'], function (input_index, input) {
1047
+ var i = $('#' + id + ' ' + input);
1048
+ var $i = $(i);
1049
+ if (!$i.hasClass('wpglobus-hidden')) {
1050
+ $i.addClass('wpglobus-hidden');
1051
+ $i.css('display', 'none');
1052
+ var l = $i.parent('label');
1053
+ var p = $i.parents('p');
1054
+ $(p).css('height', '80px');
1055
+ $(l).append('<div style="color:#f00;">' + WPGlobusAdmin.i18n.save_nav_menu + '</div>');
1056
+ }
1057
+ });
1058
+ $li.addClass('wpglobus-menu-item');
1059
+ });
1060
+ }
1061
+ };
1062
+
1063
+ $.ajaxSetup({
1064
+ beforeSend: function (jqXHR, PlainObject) {
1065
+ if (typeof PlainObject.data === 'undefined') {
1066
+ return;
1067
+ }
1068
+ if (PlainObject.data.indexOf('action=add-menu-item') >= 0) {
1069
+ menu_size = $(menu_item).length;
1070
+ iID = setInterval(timer, 500);
1071
+ }
1072
+ }
1073
+ });
1074
+
1075
+ $(menu_item).each(function (index, li) {
1076
+
1077
+ var id = $(li).attr('id'),
1078
+ item_id = id.replace('menu-item-', '');
1079
+
1080
+ $.each(['input.edit-menu-item-title', 'input.edit-menu-item-attr-title'], function (input_index, input) {
1081
+ var $i = $('#' + id + ' ' + input);
1082
+ if ( $i.val() != WPGlobusAdmin.data.items[ item_id ][ input ][ 'source' ] ) {
1083
+ /**
1084
+ * fix for case when value resets by WP core
1085
+ */
1086
+ $i.val( WPGlobusAdmin.data.items[ item_id ][ input ][ 'source' ] );
1087
+ }
1088
+
1089
+ var p = $( '#' + id + ' ' + input ).parents('p');
1090
+ var height = 0;
1091
+
1092
+ $.each(WPGlobusAdmin.data.open_languages, function (index, language) {
1093
+ var new_element = $i.clone();
1094
+ new_element.attr('id', $i.attr('id') + '-' + language);
1095
+ new_element.attr('name', $i.attr('id') + '-' + language);
1096
+ new_element.attr('data-language', language);
1097
+ new_element.attr('data-item-id', item_id);
1098
+ new_element.attr('placeholder', WPGlobusAdmin.data.en_language_name[language]);
1099
+
1100
+ var classes = WPGlobusAdmin.data.items[item_id][language][input]['class'];
1101
+ if (input_index === 0 && language === WPGlobusAdmin.data.default_language) {
1102
+ new_element.attr('class', classes + ' edit-menu-item-title');
1103
+ } else {
1104
+ new_element.attr('class', classes);
1105
+ }
1106
+
1107
+ if ( WPGlobusAdmin.data.items[ item_id ][ language ][ input ][ 'caption' ] != '' ) {
1108
+ new_element.attr('value', WPGlobusAdmin.data.items[item_id][language][input]['caption']);
1109
+ } else {
1110
+ new_element.attr('value', '');
1111
+ }
1112
+ new_element.css('margin-bottom', '0.6em');
1113
+ $(p).append( new_element );
1114
+ height = index;
1115
+ });
1116
+ height = (height + 1) * 40;
1117
+ $i.css('display', 'none').attr('class', '').addClass('widefat wpglobus-hidden');
1118
+ $(p).css('height', height + 'px').addClass('wpglobus-menu-item-box');
1119
+
1120
+ });
1121
+ $(li).addClass('wpglobus-menu-item');
1122
+ });
1123
+
1124
+ $('.menus-move-left, .menus-move-right').each(function(index,e) {
1125
+ var $e = $(e), new_title;
1126
+ var item_id = $e.parents('li').attr('id').replace('menu-item-', '');
1127
+ var title = $e.attr('title');
1128
+ if ( typeof title !== 'undefined' ) {
1129
+ $.each(WPGlobusAdmin.data.post_titles, function(post_title, item_title) {
1130
+ if ( title.indexOf(post_title) >= 0 ) {
1131
+ new_title = title.replace(post_title, item_title);
1132
+ $e.attr('title', new_title);
1133
+ $e.text(new_title);
1134
+ }
1135
+ });
1136
+ }
1137
+ });
1138
+
1139
+ /**
1140
+ * Run the item handle title when the navigation label was loaded.
1141
+ * @see wp-admin\js\nav-menu.js
1142
+ */
1143
+ $('.edit-menu-item-title').trigger('change');
1144
+ wpNavMenu.refreshAdvancedAccessibility();
1145
+ wpNavMenu.menusChanged = false;
1146
+
1147
+ $('.wpglobus-menu-item').on('change', function () {
1148
+ var $this = $(this),
1149
+ item_id = $this.data('item-id'),
1150
+ s, so;
1151
+ if ($this.hasClass('wpglobus-item-title')) {
1152
+ s = WPGlobusCore.getString( $('input#edit-menu-item-title-' + item_id).val(), $this.val(), $this.data('language') );
1153
+ so = $(document).triggerHandler('wpglobus_get_menu_translations', {string:s, lang:WPGlobusCoreData.open_languages, id:item_id, type:'input.edit-menu-item-title'});
1154
+ if ( typeof so !== 'undefined' ) {
1155
+ s = so;
1156
+ }
1157
+ $('input#edit-menu-item-title-' + item_id).val(s);
1158
+ }
1159
+ if ($this.hasClass('wpglobus-item-attr')) {
1160
+ s = WPGlobusCore.getString( $('input#edit-menu-item-attr-title-' + item_id).val(), $this.val(), $this.data('language') );
1161
+ so = $(document).triggerHandler('wpglobus_get_menu_translations', {string:s, lang:WPGlobusCoreData.open_languages, id:item_id, type:'input.edit-menu-item-attr-title'});
1162
+ if ( typeof so !== 'undefined' ) {
1163
+ s = so;
1164
+ }
1165
+ $('input#edit-menu-item-attr-title-' + item_id).val(s);
1166
+ }
1167
+
1168
+ });
1169
+ },
1170
+ postEdit: function () {
1171
+ /**
1172
+ * Hook into the heartbeat-send.
1173
+ */
1174
+ $(document).on('heartbeat-send', function(e, data) {
1175
+ if ( typeof data['wp_autosave'] !== 'undefined' ) {
1176
+ data['wpglobus_heartbeat'] = 'wpglobus';
1177
+ $.each(WPGlobusAdmin.data.open_languages, function(i,l){
1178
+ var v = $('#title_'+l).val() || '';
1179
+ v = $.trim(v);
1180
+ if ( v != '' ) {
1181
+ data['wp_autosave']['post_title_'+l] = v;
1182
+ }
1183
+ v = $('#content_'+l).val() || '';
1184
+ v = $.trim(v);
1185
+ if ( v != '' ) {
1186
+ data['wp_autosave']['content_'+l] = v;
1187
+ }
1188
+ });
1189
+ }
1190
+ });
1191
+
1192
+ var wrap_at = '#postdivrich',
1193
+ set_title = true,
1194
+ content_tabs_id = '#post-body-content';
1195
+ if ( WPGlobusAdmin.data.support['editor'] === false ) {
1196
+ wrap_at = '#titlediv';
1197
+ set_title = false;
1198
+ }
1199
+ if ( WPGlobusAdmin.data.support['title'] === false ) {
1200
+ set_title = false;
1201
+ }
1202
+ /**
1203
+ * Make post-body-content as tabs container.
1204
+ */
1205
+ $(content_tabs_id).prepend($('.wpglobus-post-body-tabs-list'));
1206
+ $.each(WPGlobusAdmin.tabs, function (index, suffix) {
1207
+ if ('default' === suffix) {
1208
+ $(wrap_at).wrap('<div id="tab-default"></div>');
1209
+ if ( set_title ) {
1210
+ $($('#titlediv')).insertBefore(wrap_at);
1211
+ }
1212
+ } else {
1213
+ $(wrap_at+'-' + suffix).wrap('<div id="tab-' + suffix + '"></div>');
1214
+ if ( set_title ) {
1215
+ $($('#titlediv-' + suffix)).insertBefore(wrap_at+'-' + suffix);
1216
+ }
1217
+ }
1218
+ });
1219
+
1220
+ /**
1221
+ * Tabs on.
1222
+ */
1223
+ $(content_tabs_id).addClass('wpglobus-post-body-tabs').tabs({
1224
+ beforeActivate: function( event, ui ){
1225
+ var otab = ui.oldTab[0].id.replace('link-tab-','');
1226
+ var ntab = ui.newTab[0].id.replace('link-tab-','');
1227
+ if ( 'default' == otab ) {
1228
+ otab = WPGlobusCoreData.default_language;
1229
+ }
1230
+ if ( 'default' == ntab ) {
1231
+ ntab = WPGlobusCoreData.default_language;
1232
+ }
1233
+ var a = $(document).triggerHandler('wpglobus_post_body_tabs', [ otab, ntab ]);
1234
+ if ( a || typeof a === 'undefined' ) {
1235
+ return true;
1236
+ }
1237
+ return false;
1238
+ }
1239
+ }); /** #post-body-content */
1240
+
1241
+ /**
1242
+ * Setup for default language.
1243
+ */
1244
+ $('#title').val(WPGlobusAdmin.title);
1245
+
1246
+ /**
1247
+ * See other places with the same bookmark.
1248
+ * @bookmark EDITOR_LINE_BREAKS
1249
+ */
1250
+ //$('#content').text(WPGlobusAdmin.content.replace(/\n/g, "<p>"));
1251
+
1252
+ $('#content').text(WPGlobusAdmin.content);
1253
+
1254
+ if (typeof WPGlobusVendor !== "undefined" && WPGlobusVendor.vendor.WPSEO ) {
1255
+ if ( typeof wpglobus_wpseo !== "undefined" ) {
1256
+ wpglobus_wpseo();
1257
+ } else if ( 'undefined' !== typeof WPGlobusYoastSeo ) {
1258
+ if ( 'undefined' !== typeof WPGlobusYoastSeoPremium ) {
1259
+ /**
1260
+ * @since WPGlobus 1.7.2
1261
+ */
1262
+ if ( WPGlobusYoastSeoPremium ) {
1263
+ WPGlobusYoastSeoPremium.init();
1264
+ }
1265
+ }
1266
+ /**
1267
+ * @since Yoast SEO 3.0
1268
+ */
1269
+ WPGlobusYoastSeo.init();
1270
+ }
1271
+ }
1272
+
1273
+ if ( WPGlobusAdmin.data.modify_excerpt ) {
1274
+ /**
1275
+ * Add excerpt fields from template.
1276
+ */
1277
+ var $excerpt = $( '#excerpt' );
1278
+ $excerpt.addClass( 'hidden' ).css( {'display':'none'} );
1279
+ $( WPGlobusAdmin.data.template ).insertAfter( $excerpt );
1280
+ $( 'body' ).on( 'change', '.wpglobus-excerpt', function () {
1281
+ var $t = $( this );
1282
+ $excerpt.val( WPGlobusCore.getString( $excerpt.val(), $t.val(), $t.data('language') ) );
1283
+ });
1284
+ }
1285
+
1286
+ /**
1287
+ * wp_editor word count.
1288
+ * from WordPress 4.3 @see \wp-admin\js\post.js
1289
+ */
1290
+ if ( typeof wp.utils !== 'undefined' && typeof wp.utils.WordCounter !== 'undefined' ) {
1291
+ WPGlobusCoreData.wordCounter = {};
1292
+
1293
+ var self = this, wpglobusEditors = {};
1294
+
1295
+ $.each( WPGlobusCoreData.enabled_languages, function( i, l ){
1296
+ if ( l == WPGlobusCoreData.default_language ) {
1297
+ return true;
1298
+ }
1299
+ wpglobusEditors[i] = 'content_'+l;
1300
+
1301
+ ( function( $, counter, l ) {
1302
+ WPGlobusCoreData.wordCounter[ l ] = {};
1303
+ WPGlobusCoreData.wordCounter[ l ][ 'counter' ] = counter;
1304
+
1305
+ $( function() {
1306
+
1307
+ WPGlobusCoreData.wordCounter[ l ][ 'content' ] = $( '#content_'+l );
1308
+ WPGlobusCoreData.wordCounter[ l ][ 'count' ] = $( '#wp-word-count-'+l ).find( '.word-count-'+l );
1309
+
1310
+ WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] = 0;
1311
+
1312
+ function update( l ) {
1313
+ var text, count;
1314
+
1315
+ if ( typeof l === 'object' ) {
1316
+
1317
+ if ( l == 'tinymce' ) {
1318
+ /** wysiwyg editor */
1319
+ l = self.getCurrentTab();
1320
+ } else {
1321
+ /** textarea */
1322
+ l = l.target.id.replace( 'content_', '' );
1323
+ }
1324
+
1325
+ }
1326
+
1327
+ if ( typeof WPGlobusCoreData.wordCounter[ l ] === 'undefined' ) {
1328
+ return;
1329
+ }
1330
+
1331
+ if ( ! WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ] ||
1332
+ WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ].isHidden() ) {
1333
+
1334
+ text = WPGlobusCoreData.wordCounter[ l ][ 'content' ].val();
1335
+
1336
+ } else {
1337
+ text = WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ].getContent( { format: 'raw' } );
1338
+ }
1339
+
1340
+ count = WPGlobusCoreData.wordCounter[ l ][ 'counter' ].count( text );
1341
+
1342
+ if ( count !== WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] ) {
1343
+ WPGlobusCoreData.wordCounter[ l ][ 'count' ].text( count );
1344
+ }
1345
+
1346
+ WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] = count;
1347
+ }
1348
+
1349
+ $(document).on( 'tinymce-editor-init', function( event, editor ) {
1350
+
1351
+ if ( -1 == $.inArray(editor.id, wpglobusEditors) ) {
1352
+ /**
1353
+ * Init WPGlobus editor only.
1354
+ */
1355
+ return;
1356
+ }
1357
+ var l = editor.id.replace( 'content_', '' );
1358
+
1359
+ WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ] = editor;
1360
+
1361
+ editor.on( 'nodechange keyup', _.debounce( update, 1000 ) );
1362
+ } );
1363
+
1364
+ WPGlobusCoreData.wordCounter[l]['content'].on( 'input keyup', _.debounce( update, 1000 ) );
1365
+
1366
+ update( l );
1367
+
1368
+ } );
1369
+ } )( jQuery, new wp.utils.WordCounter(), l );
1370
+ });
1371
+
1372
+ }
1373
+
1374
+ $(document).on('click', '#publish, #save-post', function() {
1375
+ if ( WPGlobusAdmin.data.open_languages.length > 1 ) {
1376
+ $(document).triggerHandler('wpglobus_before_save_post', {content_tabs_id:content_tabs_id});
1377
+ /**
1378
+ * If empty title in default language make it from another titles.
1379
+ */
1380
+ var t = $('#title').val(),
1381
+ index, title = '', delimiter = '';
1382
+
1383
+ if ( t.length == 0 ) {
1384
+ index = WPGlobusAdmin.data.open_languages.indexOf(WPGlobusAdmin.data.default_language);
1385
+ WPGlobusAdmin.data.open_languages.splice(index, 1);
1386
+ $(WPGlobusAdmin.data.open_languages).each(function(i,l){
1387
+ delimiter = i == 0 ? '' : '-';
1388
+ t = $('#title_'+l).val();
1389
+ if ( t.length > 0 ) {
1390
+ if ( title.length == 0 ) { delimiter = '';}
1391
+ title = title + delimiter + t;
1392
+ }
1393
+ });
1394
+ }
1395
+ if ( title.length > 0 ) {
1396
+ $('#title').val(title);
1397
+ }
1398
+ }
1399
+
1400
+ /**
1401
+ * To handle taxonomy tags.
1402
+ */
1403
+ if ( 'undefined' === typeof WPGlobusAdmin.data.tagsdiv || WPGlobusAdmin.data.tagsdiv.length < 1 ) {
1404
+ return;
1405
+ }
1406
+ $(WPGlobusAdmin.data.tagsdiv).each(function(i,tagsdiv){
1407
+ if ($('#' + tagsdiv).length == 0) {
1408
+ /**
1409
+ * Next iteration.
1410
+ */
1411
+ return true;
1412
+ }
1413
+
1414
+ var id = tagsdiv.replace('tagsdiv-', '');
1415
+ if ( 'undefined' === id ) {
1416
+ return true;
1417
+ }
1418
+ if ( $('#tax-input-'+id).length == 0 ) {
1419
+ return true;
1420
+ }
1421
+
1422
+ var name, tags = [];
1423
+
1424
+ $('#tagsdiv-'+id+' .tagchecklist > span').each(function(i,e){
1425
+ name = $(e).html();
1426
+ name = name.replace( /<button.*<\/button>&nbsp;/, '' );
1427
+ if ( 'undefined' === typeof WPGlobusAdmin.data.tag[id][name] ) {
1428
+ tags[i] = name;
1429
+ } else {
1430
+ tags[i] = WPGlobusAdmin.data.tag[id][name];
1431
+ }
1432
+ });
1433
+
1434
+ $('#tax-input-'+id).val(tags.join(', '));
1435
+ });
1436
+ /**
1437
+ * The end to handle taxonomy tags.
1438
+ */
1439
+ });
1440
+
1441
+ /**
1442
+ * The alignment when default tab was clicked.
1443
+ */
1444
+ $('.ui-state-default').on('click', function () {
1445
+ if ('link-tab-default' === $(this).attr('id')) {
1446
+ $(window).scrollTop($(window).scrollTop() + 1);
1447
+ $(window).scrollTop($(window).scrollTop() - 1);
1448
+ }
1449
+ });
1450
+
1451
+ /**
1452
+ * Set current value after language tab of content was changed.
1453
+ */
1454
+ $(document).on( 'tabsactivate', content_tabs_id, function( event, ui ) {
1455
+ WPGlobusAdmin.currentTab = ui.newTab[0].dataset.language;
1456
+ });
1457
+
1458
+ $(document).triggerHandler('wpglobus_after_post_edit');
1459
+
1460
+ },
1461
+ adminCentral: function () {
1462
+ $( '.wpglobus-admin-central-tab' ).css({ 'display':'none' });
1463
+
1464
+ if ( $( '.nav-tab-active' ).length > 1 ) {
1465
+ $( '.wpglobus-about-wrap .nav-tab-wrapper a' ).removeClass( 'nav-tab-active' );
1466
+ }
1467
+
1468
+ var setFirstElement = true;
1469
+ if ( 0 == location.hash.indexOf( '#' ) ) {
1470
+ $( '.wpglobus-about-wrap .nav-tab-wrapper a').each( function( i, e ) {
1471
+ if ( $(e).attr( 'href' ) == location.hash ) {
1472
+ setFirstElement = false;
1473
+ $(e).addClass( 'nav-tab-active' );
1474
+ }
1475
+ });
1476
+ }
1477
+ if ( setFirstElement ) {
1478
+ $( '.wpglobus-about-wrap .nav-tab-wrapper a' ).eq(0).addClass( 'nav-tab-active' );
1479
+ }
1480
+
1481
+ var activePanel = $( '.wpglobus-about-wrap .nav-tab-active' ).data( 'tab-id' );
1482
+ if ( '' != activePanel ) {
1483
+ $( '#'+activePanel ).css({'display':'block'});
1484
+ }
1485
+
1486
+ $(document).on( 'click', '.wpglobus-about-wrap .nav-tab', function(event){
1487
+ var $t = $( this );
1488
+ if ( $t.hasClass( 'nav-tab-active' ) ) {
1489
+ return;
1490
+ }
1491
+ $( '.wpglobus-admin-central-tab' ).css({ 'display':'none' });
1492
+ $( '.wpglobus-about-wrap .nav-tab' ).removeClass( 'nav-tab-active' );
1493
+ $t.addClass( 'nav-tab-active' );
1494
+ if ( '' != $t.data( 'tab-id' ) ) {
1495
+ $( '#' + $t.data( 'tab-id' ) ).css({ 'display':'block' });
1496
+ }
1497
+ });
1498
+ },
1499
+ start: function () {
1500
+ var t = this;
1501
+ $('#wpglobus_flags').select2({
1502
+ formatResult: this.format,
1503
+ formatSelection: this.format,
1504
+ minimumResultsForSearch: -1,
1505
+ escapeMarkup: function (m) {
1506
+ return m;
1507
+ }
1508
+ });
1509
+
1510
+ /** disable checked off first language */
1511
+ $('body').on('click', '#enabled_languages-list li:first input', function (event) {
1512
+ event.preventDefault();
1513
+ $('.redux-save-warn').css({'display': 'none'});
1514
+ $('#enabled_languages-list').find('li:first > input').val('1');
1515
+ if ($('#disable_first_language').length === 0) {
1516
+ $(t.config.disable_first_language).insertAfter('#info_bar');
1517
+ }
1518
+ return false;
1519
+ });
1520
+
1521
+ },
1522
+ format: function (language) {
1523
+ return '<img class="wpglobus_flag" src="' + WPGlobusAdmin.flag_url + language.text + '"/>&nbsp;&nbsp;' + language.text;
1524
+ },
1525
+ set_dialog: function() {
1526
+
1527
+ if ( 'undefined' !== typeof WPGlobusAdmin.data.customFieldsEnabled ) {
1528
+ WPGlobusAdmin.data.customFieldsEnabled = this.parseBool( WPGlobusAdmin.data.customFieldsEnabled );
1529
+ if ( ! WPGlobusAdmin.data.customFieldsEnabled ) {
1530
+ return;
1531
+ }
1532
+ }
1533
+
1534
+ var ajaxify_row_id, added_control = false;
1535
+ var add_elements = function(post_id) {
1536
+
1537
+ var id, rows, cb, _cb,
1538
+ _classes = 'wpglobus_dialog_start wpglobus_dialog_icon';
1539
+
1540
+ _cb = [
1541
+ '<div class="wpglobus_dialog_options_wrapper hidden">',
1542
+ '<input style="width:initial;" id="wpglobus-cb-{{id}}" data-object="#wpglobus-dialog-start-{{id}}" data-meta-key="{{meta-key}}" class="wpglobus_dialog_option wpglobus_dialog_cb" type="checkbox" {{checked}} />',
1543
+ '</div>'
1544
+ ].join('');
1545
+
1546
+ if (typeof post_id == 'undefined') {
1547
+ rows = '#the-list tr';
1548
+ } else {
1549
+ rows = '#the-list tr#'+post_id;
1550
+ }
1551
+ $(rows).each(function(){
1552
+ var $t = $(this),
1553
+ tid = $t.attr('id'),
1554
+ element = $t.find('textarea'),
1555
+ clone, name, meta_key,
1556
+ classes = _classes;
1557
+
1558
+ id = element.attr('id');
1559
+ if ( undefined === id ) {
1560
+ return true;
1561
+ }
1562
+ meta_key = $('#'+tid+'-key').val();
1563
+ clone = $('#'+id).clone();
1564
+ $(element).addClass('wpglobus-dialog-field-source hidden');
1565
+ name = element.attr('name');
1566
+ $(clone).attr('id', 'wpglobus-'+id);
1567
+ $(clone).attr('name', 'wpglobus-'+name);
1568
+ $(clone).attr('data-source-id', id);
1569
+ $(clone).attr('class', 'wpglobus-dialog-field');
1570
+ $(clone).val( WPGlobusCore.TextFilter($(element).val(), WPGlobusCoreData.language) );
1571
+ $(clone).insertAfter(element);
1572
+ cb = _cb.replace(/{{id}}/g, id);
1573
+ cb = cb.replace(/{{meta-key}}/g, meta_key);
1574
+ if ( undefined === WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type] ) {
1575
+ cb = cb.replace(/{{checked}}/, 'checked');
1576
+ } else {
1577
+ if ( undefined !== WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][meta_key] && WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][meta_key] == 'false' ) {
1578
+ cb = cb.replace(/{{checked}}/, '');
1579
+ classes = _classes+' wpglobus_dialog_start_hidden';
1580
+ } else {
1581
+ cb = cb.replace(/{{checked}}/, 'checked');
1582
+ classes = _classes;
1583
+ }
1584
+ }
1585
+ $t.append('<td style="width:20px;"><div id="wpglobus-dialog-start-'+id+'" data-type="control" data-source-type="textarea" data-source-id="'+id+'" class="'+classes+'"></div>'+cb+'</td>');
1586
+ });
1587
+ if ( ! added_control && $('#list-table .wpglobus_dialog_start').length > 0 ) {
1588
+ $('#list-table thead tr').append('<th class="wpglobus-control-head"><div class="wpglobus_dialog_settings wpglobus_dialog_icon"></div></th>');
1589
+ added_control = true;
1590
+ }
1591
+ }
1592
+
1593
+ add_elements();
1594
+
1595
+ $('body').on('change', '.wpglobus-dialog-field', function(){
1596
+ var $t = $(this),
1597
+ source_id = '#'+$t.data('source-id'),
1598
+ source = '', s = '', new_value;
1599
+
1600
+ if ( typeof source_id == 'undefined' ) {
1601
+ return;
1602
+ }
1603
+ source = $(source_id).val();
1604
+
1605
+ if ( ! /(\{:|\[:|<!--:)[a-z]{2}/.test(source) ) {
1606
+ $(source_id).val($t.val());
1607
+ } else {
1608
+ $.each(WPGlobusCoreData.enabled_languages, function(i,l){
1609
+ if ( l == WPGlobusCoreData.language ) {
1610
+ new_value = $t.val();
1611
+ } else {
1612
+ new_value = WPGlobusCore.TextFilter(source,l,'RETURN_EMPTY');
1613
+ }
1614
+ if ( '' != new_value ) {
1615
+ s = s + WPGlobusCore.addLocaleMarks(new_value,l);
1616
+ }
1617
+ });
1618
+ $(source_id).val(s);
1619
+ }
1620
+
1621
+ });
1622
+
1623
+ $(document).ajaxSend(function(event, jqxhr, settings){
1624
+ if ( 'add-meta' == settings.action ) {
1625
+ ajaxify_row_id = settings.element;
1626
+ }
1627
+ });
1628
+ $(document).ajaxComplete(function(event, jqxhr, settings){
1629
+ if ( 'add-meta' == settings.action && undefined !== jqxhr.responseXML ) {
1630
+ if ( 'newmeta' == ajaxify_row_id ) {
1631
+ add_elements('meta-'+$(jqxhr.responseXML.documentElement.outerHTML).find('meta').attr('id'));
1632
+ } else {
1633
+ add_elements(ajaxify_row_id);
1634
+ }
1635
+ }
1636
+ });
1637
+
1638
+ WPGlobusDialogApp.init({dialogTitle:'Edit meta'});
1639
+
1640
+ }
1641
+ };
1642
+
1643
+ new WPGlobusAdminApp.App();
1644
+
1645
+ return WPGlobusAdminApp;
1646
+
1647
+ }(window.WPGlobusAdminApp || {}, jQuery));
1648
+
1649
+ });
includes/js/wpglobus-admin-47.min.js CHANGED
@@ -1 +1 @@
1
- var WPGlobusCore;!function(t){var a;a=WPGlobusCore={strpos:function(t,a,e){var o=(t=""+t).indexOf(a,e);return o>=0&&o},TextFilter:function(t,e,o){if(void 0===t||""===t)return t;var n,i,l=[],s=!1;e=""==e?"en":e,o=void 0===o||""==o?"RETURN_IN_DEFAULT_LANGUAGE":o,l[0]=[],l[0].start=WPGlobusCoreData.locale_tag_start.replace("%s",e),l[0].end=WPGlobusCoreData.locale_tag_end,l[1]=[],l[1].start="\x3c!--:"+e+"--\x3e",l[1].end="\x3c!--:--\x3e",l[2]=[],l[2].start="[:"+e+"]",l[2].end="[:";for(var d=0;d<3;d++)if(!1!==(n=a.strpos(t,l[d].start))){n+=l[d].start.length,t=!1===(i=a.strpos(t,l[d].end,n))?t.substr(n):t.substr(n,i-n),s=!0;break}return s||("RETURN_EMPTY"==o?(e!=WPGlobusCoreData.default_language||/(\{:|\[:|<!--:)[a-z]{2}/.test(t))&&(t=""):e==WPGlobusCoreData.default_language?/(\{:|\[:|<!--:)[a-z]{2}/.test(t)&&(t=""):t=a.TextFilter(t,WPGlobusCoreData.default_language)),t},addLocaleMarks:function(t,a){return WPGlobusCoreData.locale_tag_start.replace("%s",a)+t+WPGlobusCoreData.locale_tag_end},getTranslations:function(e){var o,n={};return t.each(WPGlobusCoreData.enabled_languages,function(t,i){o=i==WPGlobusCoreData.default_language?"RETURN_IN_DEFAULT_LANGUAGE":"RETURN_EMPTY",n[i]=a.TextFilter(e,i,o)}),n},getString:function(e,o,n){if(void 0===e)return e;void 0===o&&(o=""),void 0===n&&(n=WPGlobusCoreData.language),(e=a.getTranslations(e))[n]=o;var i="";return t.each(e,function(t,e){""!=e&&t!=WPGlobusCoreData.default_language&&(i+=a.addLocaleMarks(e,t))}),""!=e[WPGlobusCoreData.default_language]&&(i=""==i?e[WPGlobusCoreData.default_language]:a.addLocaleMarks(e[WPGlobusCoreData.default_language],WPGlobusCoreData.default_language)+i),i}}}(jQuery);var WPGlobusDialogApp;!function(t){var a;a=WPGlobusDialogApp={option:{listenClass:".wpglobus_dialog_start",settingsClass:".wpglobus_dialog_settings",dialogTabs:"#wpglobus-dialog-tabs",dialogTitle:"",customData:null,callback:function(){},dialogOptions:{title:"",placeholder:"",formFooter:"",beforeOpen:function(){},close:function(){}},dialog:{}},form:void 0,element:void 0,element_by:"id",id:"",clone_id:"",wpglobus_id:"",type:"textarea",source:"",order:{},value:{},request:"core",attrs:{},dialogTitle:"",trClass:"wpglobus-translatable",startButton:['<span id="wpglobus-dialog-start-{{clone_id}}" ','style="{{style}}" ','data-type="control" data-dialog-title="{{title}}" ','data-source-type="" data-source-id="{{id}}" data-source-name="{{name}}" ','data-nodename="{{nodename}}"',"{{sbTitle}} ",'class="{{classes}}"></span>'].join(""),startButtonClass:"wpglobus_dialog_start wpglobus_dialog_icon",clicks:0,init:function(e){a.option.dialog=a.option.dialogOptions,a.option=t.extend(a.option,e),t(a.option.dialogTabs).tabs(),a.dialogTitle=a.option.dialogTitle,this.attachListener(),null!=a.option.customData&&void 0!==a.option.customData.addElements&&t.each(a.option.customData.addElements,function(t,e){a.addElement(e)})},convertToId:function(t){return t=(t=t.replace(/\]/g,"")).replace(/\[/g,"-")},addElement:function(e){var o={id:null,style:"",styleTextareaWrapper:"",sbTitle:"",onChangeClass:"",dialogTitle:"",dialog:a.option.dialogOptions};if("string"==typeof e)o.id=e;else{if("object"!=typeof e)return;o=t.extend(o,e)}var n,i,l,s=null,d=null,u=null,r=null,c=a.startButton,g="";if(a.element_by="name",0==(r=document.getElementsByName(o.id)).length&&(a.element_by="id",r=document.getElementById(o.id)),null!==r){if(d=o.id,"id"==a.element_by?s=t("#"+d):(g=(g=r[0].nodeName).toLowerCase(),s=t(g+'[name="'+d+'"]')),u=void 0===s.attr("name")||""==s.attr("name")?d:s.attr("name"),a.clone_id=a.convertToId(d),-1!=u.indexOf("wpglobus")||-1!=a.clone_id.indexOf("wpglobus"))return!1;if(t("#wpglobus-"+a.clone_id).length>0)return!1;if(t(g+'[name="wpglobus-'+u+'"]').length>0)return!1;n=t(s.clone()),l=s.attr("style")||"",s.attr("style","display:none;"),n.attr("id","wpglobus-"+a.clone_id).attr("name","wpglobus-"+u),n.addClass(a.trClass),""!=o.onChangeClass&&n.addClass(o.onChangeClass),"id"==a.element_by?n.attr("data-source-id",d).attr("data-source-name","").attr("data-source-get-by",a.element_by):n.attr("data-source-id","").attr("data-source-name",u).attr("data-source-get-by",a.element_by),"textarea"==g?(i=WPGlobusCore.getTranslations(s.val())[WPGlobusCoreData.language],n.val(i),n.attr("data-nodename","textarea"),""==o.style?n.attr("style",l+";width:95%;float:left;"):n.attr("style",l+";"+o.style)):(i=WPGlobusCore.getTranslations(s.val())[WPGlobusCoreData.language],n.attr("value",i),n.attr("data-nodename","input"),""!=o.style&&n.attr("style",l+";"+o.style)),""!=o.dialog&&n.attr("data-dialog",JSON.stringify(o.dialog)),c=c.replace(/{{clone_id}}/g,a.clone_id),c="id"==a.element_by?(c=(c=c.replace(/{{id}}/g,a.clone_id)).replace(/{{name}}/g,"")).replace(/{{nodename}}/g,""):(c=(c=c.replace(/{{id}}/g,"")).replace(/{{name}}/g,u)).replace(/{{nodename}}/g,g),c="textarea"==g?c.replace("{{style}}","float:left;margin-top:0;"):c.replace("{{style}}","");var b="textarea"==g?a.startButtonClass+" wpglobus-textarea wpglobus-textarea-"+a.clone_id:a.startButtonClass;c=c.replace("{{classes}}",b),c=""==o.dialogTitle?c.replace("{{title}}",a.dialogTitle):c.replace("{{title}}",o.dialogTitle),c=""==o.sbTitle?c.replace("{{sbTitle}}",o.sbTitle):c.replace("{{sbTitle}}",'title="'+o.sbTitle+'"'),t(c).insertAfter(s),t(n).insertAfter(s),"textarea"==g&&(t("#wpglobus-"+a.clone_id).addClass("wpglobus-textarea-"+a.clone_id),t(".wpglobus-textarea-"+a.clone_id).wrapAll('<div class="wpglobus-textarea-wrapper" style="'+o.styleTextareaWrapper+'"></div>'));var p,m=!1;if(""==o.onChangeClass)p="#wpglobus-"+a.clone_id;else{p="."+o.onChangeClass;var v=t._data(t(document)[0],"events");void 0===v?m=!0:void 0!==v.change&&t.each(v.change,function(t,a){if(a.selector==p)return m=!0,!1})}return!!m||(t(document).on("change",p,function(){var a=t(this),e=a.data("source-id");e=""==e?a.data("nodename")+'[name="'+a.data("source-name")+'"]':"#"+e,t(e).val(WPGlobusCore.getString(t(e).val(),a.val()))}),!0)}},saveDialog:function(){var e,o,n,i="",l="",s="";t(".wpglobus_dialog_textarea").each(function(a,d){e=t(d),o=e.val(),(n=e.data("language"))==WPGlobusAdmin.data.language&&(s=o),""!=o&&(i+=WPGlobusCore.addLocaleMarks(o,n),n==WPGlobusCoreData.default_language&&(l=o))}),i=i.length==l.length+8?l:i,t(a.id).val(i),i=""==s?l:s,t(a.wpglobus_id).val(i)},dialog:t("#wpglobus-dialog-wrapper").dialog({autoOpen:!1,width:650,modal:!0,dialogClass:"wpglobus-dialog",buttons:[{text:"Save",class:"wpglobus-button-save",click:function(){a.saveDialog(),a.dialog.dialog("close")}},{text:"Cancel",class:"wpglobus-button-cancel",click:function(){a.dialog.dialog("close")}}],open:function(e,o){var n=a.dialogTitle;void 0!==a.attrs.maxlength&&(t(".wpglobus_dialog_textarea").attr("maxlength",a.attrs.maxlength),n+=" | maxlength="+a.attrs.maxlength),t(".wpglobus-dialog .ui-dialog-title").text(n)},close:function(){a.runCallback(a.option.dialog.close),a.form[0].reset()}}),attachListener:function(){t(document).on("click",a.option.settingsClass,function(){t(".wpglobus_dialog_options_wrapper").hasClass("hidden")?t(".wpglobus_dialog_options_wrapper").removeClass("hidden"):t(".wpglobus_dialog_options_wrapper").addClass("hidden")}),t(document).on("click",".wpglobus_dialog_option",function(e){var o=t(this),n=o.data("object");a.order.action="save_post_meta_settings",a.order.post_type=WPGlobusAdmin.data.post_type,a.order.checked=o.prop("checked"),a.order.id=o.attr("id"),a.order.meta_key=o.data("meta-key"),a.ajax(a.order).done(function(a){"ok"==a.result&&("true"==a.checked?t(n).removeClass("wpglobus_dialog_start_hidden"):t(n).addClass("wpglobus_dialog_start_hidden"))}).fail(function(t){}).always(function(t,a){})}),t(document).on("click",a.option.listenClass,function(e){a.element=t(this),a.id=a.element.data("source-id"),""==a.id?(a.id=a.element.data("nodename")+'[name="'+a.element.data("source-name")+'"]',a.wpglobus_id="#wpglobus-"+a.convertToId(a.element.data("source-name"))):(a.wpglobus_id="#wpglobus-"+a.id,a.id="#"+a.id),a.clicks++,1==a.clicks&&setTimeout(function(){if(1==a.clicks)a.onClick(e);else{var o=t(a.id);o.hasClass("hidden")?o.removeClass("hidden").attr("style","display:block;"):o.addClass("hidden").attr("style","display:none;")}a.clicks=0},200)}),a.form=a.dialog.find("form#wpglobus-dialog-form").on("submit",function(t){t.preventDefault(),a.saveDialog()})},ajax:function(a){return t.ajax({type:"POST",url:WPGlobusAdmin.ajaxurl,data:{action:WPGlobusAdmin.process_ajax,order:a},dataType:"json",async:!1})},onClick:function(e){void 0===a.element.data("dialog-title")||""==a.element.data("dialog-title")?a.dialogTitle=a.option.dialogTitle:a.dialogTitle=a.element.data("dialog-title"),void 0!==a.id&&(a.attrs.maxlength=t(a.id).attr("maxlength")),a.source=a.element.data("source-value"),void 0===a.source&&(a.source=t(a.id).val(),"ajax"==a.request||(a.value=WPGlobusCore.getTranslations(a.source))),a.option.dialog=t.extend({},a.option.dialogOptions,t(a.wpglobus_id).data("dialog")),""!=a.option.dialog.title&&(a.dialogTitle=a.option.dialog.title),t.each(a.value,function(e,o){var n=t("#wpglobus-dialog-"+e);n.val(o),n.attr("placeholder",WPGlobusCore.TextFilter(a.option.dialog.placeholder,e,"RETURN_IN_DEFAULT_LANGUAGE"))}),t("#wpglobus-dialog-form-footer").html(a.option.dialog.formFooter),a.runCallback(a.option.dialog.beforeOpen),a.dialog.dialog("open")},runCallback:function(t){if("object"==typeof t){var a=Object.keys(t)[0],e=t[Object.keys(t)[0]];"window"===a?"function"==typeof window[e]&&window[e](t[Object.keys(t)[1]]):"function"==typeof window[a][e]&&window[a][e](t[Object.keys(t)[1]])}else"string"==typeof t&&"function"==typeof window[t]&&window[t]()}}}(jQuery),jQuery(document).ready(function(){"use strict";window.WPGlobusAdminApp=(t=window.WPGlobusAdminApp||{},a=jQuery,t.App=function(t){void 0===window.WPGlobusAdminApp&&(this.config={debug:!1,version:WPGlobusAdmin.version},this.status="ok","undefined"==typeof WPGlobusAdmin?(this.status="error",this.config.debug&&console.log("WPGlobus: error options loading")):this.config.debug&&console.dir(WPGlobusAdmin),this.config.disable_first_language=['<div id="disable_first_language" style="display:block;" class="redux-field-errors notice-red">',"<strong>","<span>&nbsp;</span>",WPGlobusAdmin.i18n.cannot_disable_language,"</strong>","</div>"].join(""),a.extend(this.config,t),"ok"===this.status&&this.init())},t.App.prototype={$document:a(document),init:function(){WPGlobusCoreData.multisite=this.parseBool(WPGlobusCoreData.multisite),this.adminInit(),a("#content").addClass("wpglobus-editor").attr("data-language",WPGlobusAdmin.data.default_language),a("textarea[id^=content_]").each(function(t,e){var o=a(e).attr("id").replace("content_","");a(e).attr("data-language",o)}),"post.php"===WPGlobusAdmin.page?(this.postEdit(),this.set_dialog(),"undefined"!=typeof WPGlobusAioseop&&WPGlobusAioseop.init()):"menu-edit"===WPGlobusAdmin.page?this.navMenus():"taxonomy-edit"===WPGlobusAdmin.page?WPGlobusAdmin.data.tag_id&&this.taxonomyEdit():"taxonomy-quick-edit"===WPGlobusAdmin.page?this.quickEdit("taxonomy"):"edit.php"===WPGlobusAdmin.page?this.quickEdit("post"):"options-general.php"==WPGlobusAdmin.page?this.optionsGeneral():"widgets.php"==WPGlobusAdmin.page?(WPGlobusWidgets.init(),WPGlobusDialogApp.init({dialogTitle:"Edit text"})):"wpglobus_options"==WPGlobusAdmin.page?this.start():"wpglobusAdminCentral"==WPGlobusAdmin.page?this.adminCentral():WPGlobusDialogApp.init({customData:WPGlobusCoreData.page_custom_data})},parseBool:function(t){return!/^(false|0)$/i.test(t)&&!!t},getCurrentTab:function(){return a(".wpglobus-post-body-tabs-list .ui-tabs-active").data("language")},adminInit:function(){var t=a(".wpglobus-addons-group a").data("key");if(void 0!==t)if(window.location.search.indexOf("page=wpglobus_options&tab="+t)>=0)WPGlobusCoreData.multisite?window.location=WPGlobusCoreData.pluginInstallLocation.multisite:window.location=WPGlobusCoreData.pluginInstallLocation.single;else{var e=a("#toplevel_page_wpglobus_options li").eq(t+1);WPGlobusCoreData.multisite?a(e).find("a").attr("href",WPGlobusCoreData.pluginInstallLocation.multisite).attr("onclick","window.location=jQuery(this).attr('href');return false;"):a(e).find("a").attr("href",WPGlobusCoreData.pluginInstallLocation.single).attr("onclick","window.location=jQuery(this).attr('href');return false;")}},optionsGeneral:function(){var t=a("#blogname"),e=a("body");t.addClass("hidden"),a("#wpglobus-blogname").insertAfter(t).removeClass("hidden"),e.on("blur",".wpglobus-blogname",function(){a(".wpglobus-blogname").each(function(e,o){var n=a(o);t.val(WPGlobusCore.getString(t.val(),n.val(),n.data("language")))})});var o=a("#blogdescription");o.addClass("hidden"),a("#wpglobus-blogdescription").insertAfter(o).removeClass("hidden"),e.on("blur",".wpglobus-blogdesc",function(){a(".wpglobus-blogdesc").each(function(t,e){var n=a(e);o.val(WPGlobusCore.getString(o.val(),n.val(),n.data("language")))})})},quickEdit:function(t){if(void 0!==WPGlobusAdmin.data.has_items&&WPGlobusAdmin.data.has_items){var e="",o=0;a(document).ajaxComplete(function(t,n,i){void 0!==i.data&&""!=e&&i.data.indexOf("action=inline-save-tax&")>=0&&(a("#"+e+" a.row-title").text(WPGlobusAdmin.qedit_titles[o][WPGlobusAdmin.data.language].name),a("#"+e+" .description").text(WPGlobusAdmin.qedit_titles[o][WPGlobusAdmin.data.language].description))});var n={};a("#the-list tr").each(function(e,i){var l=a(i),s="post"===t?"post-":"tag-";o=l.attr("id").replace(s,""),n[o]={},"post"===t?n[o].source=l.find(".post_title").text():"taxonomy"===t&&(n[o].source=a("#inline_"+o+" .name").text())});var i={};i.action="get_titles",i.type=t,i.taxonomy=void 0!==WPGlobusAdmin.data.taxonomy&&WPGlobusAdmin.data.taxonomy,i.title=n,a.ajax({type:"POST",url:WPGlobusAdmin.ajaxurl,data:{action:WPGlobusAdmin.process_ajax,order:i},dataType:"json"}).done(function(t){WPGlobusAdmin.qedit_titles=t.qedit_titles,a.each(t.bulkedit_post_titles,function(t,e){a("#inline_"+t+" .post_title").text(e[WPGlobusAdmin.data.language].name)})}).fail(function(t){}).always(function(t,a){}),a("body").on("change",".wpglobus-quick-edit-title",function(){var t="",e=[];a(".wpglobus-quick-edit-title").each(function(n,i){var l=a(i),s=l.data("language");""!==l.val()&&(t=WPGlobusCore.getString(t,l.val(),s)),WPGlobusAdmin.qedit_titles[o][s].name=l.val(),e[n]=s});var n=a(document).triggerHandler("wpglobus_get_translations",{string:t,lang:e,id:o});void 0!==n&&(t=n),a("input.ptitle").eq(0).attr("value",t),WPGlobusAdmin.qedit_titles[o].source=t}),void 0!==WPGlobusAdmin.data.tags&&a.each(WPGlobusAdmin.data.tags,function(t,a){WPGlobusAdmin.data.value[a].post_id={}}),a("button.save, input#bulk_edit").on("mouseenter",function(t){void 0!==WPGlobusAdmin.data.tags&&("bulk_edit"==t.currentTarget.id?a("input#bulk_edit").unbind("click"):a("button.save").unbind("click"),a("button.save, input#bulk_edit").on("click",function(t){var e=a.when(),n=(a(this),a.Deferred());n.resolve(function(e){e.next(".spinner").css({visibility:"visible"}),"bulk_edit"!=t.currentTarget.id&&a.ajaxSetup({async:!1});var o,n,i,l=e.parents("tr"),s=l.attr("id").replace("edit-","");a.each(WPGlobusAdmin.data.tags,function(t,a){if(0==(o=l.find("textarea[name='"+WPGlobusAdmin.data.names[a]+"']")).length)return!0;WPGlobusAdmin.data.value[a].post_id[s]=o.val(),n=WPGlobusAdmin.data.value[a].post_id[s].split(","),i=[];for(var e=0;e<n.length;e++)n[e]=n[e].trim(" "),""!=n[e]&&(void 0===WPGlobusAdmin.data.tag[a][n[e]]?i[e]=n[e]:i[e]=WPGlobusAdmin.data.tag[a][n[e]]);o.val(i.join(", "))})}(a(this))),e=e.then(function(){return a.when(n.done())}).then(function(){"bulk_edit"!=t.currentTarget.id&&setTimeout(function(){inlineEditPost.save(o),a.ajaxSetup({async:!0})},50)})}))}),a("#the-list").on("click","a.editinline",function(){var n=a(this);if(e=n.parents("tr").attr("id"),"post"===t)o=e.replace("post-","");else{if("taxonomy"!==t)return;o=e.replace("tag-","")}"post"===t&&void 0!==WPGlobusAdmin.data.tags&&a.each(WPGlobusAdmin.data.tags,function(t,e){if(""!=WPGlobusAdmin.data.value[e]){var n,i=a("#edit-"+o+' textarea[name="'+WPGlobusAdmin.data.names[e]+'"]').val();void 0!==i&&(n=i.split(","),a.each(n,function(t,a){i=i.replace(a,WPGlobusCore.TextFilter(a,WPGlobusCoreData.language))}),a("#edit-"+o+' textarea[name="'+WPGlobusAdmin.data.names[e]+'"]').val(i))}});var i=a("#edit-"+o+" input.ptitle").eq(0),l=i.parents("label");i.val(WPGlobusAdmin.qedit_titles[o].source),i.addClass("hidden"),a(WPGlobusAdmin.data.template).insertAfter(l),void 0===WPGlobusAdmin.qedit_titles[o]&&(WPGlobusAdmin.qedit_titles[o]={},WPGlobusAdmin.qedit_titles[o].source=a("#"+e+" .name a.row-title").text(),a(WPGlobusAdmin.data.enabled_languages).each(function(t,a){WPGlobusAdmin.qedit_titles[o][a]={},a==WPGlobusAdmin.data.default_language?WPGlobusAdmin.qedit_titles[o][a].name=WPGlobusAdmin.qedit_titles[o].source:WPGlobusAdmin.qedit_titles[o][a].name="",WPGlobusAdmin.qedit_titles[o][a].description=""})),a(".wpglobus-quick-edit-title").each(function(t,e){var n=a(e),i=n.data("language");n.attr("id",i+o),void 0!==WPGlobusAdmin.qedit_titles[o][i]&&(WPGlobusAdmin.qedit_titles[o][i].name=WPGlobusAdmin.qedit_titles[o][i].name.replace(/\\\'/g,"'"),WPGlobusAdmin.qedit_titles[o][i].name=WPGlobusAdmin.qedit_titles[o][i].name.replace(/\\\"/g,'"'),n.attr("value",WPGlobusAdmin.qedit_titles[o][i].name),WPGlobusAdmin.qedit_titles[o].source=WPGlobusCore.getString(WPGlobusAdmin.qedit_titles[o].source,WPGlobusAdmin.qedit_titles[o][i].name,i))}),a("input.ptitle").eq(0).attr("value",WPGlobusAdmin.qedit_titles[o].source)})}},taxonomyEdit:function(){var t=[];t[0]="name",t[1]="description",a.each(WPGlobusCoreData.enabled_languages,function(e,o){a.each(t,function(t,e){!function(t,e){var o,n=a("#"+t),i=n.clone(),l=n.attr("name"),s="wpglobus-element wpglobus-element_"+t+" wpglobus-element_"+e+" wpglobus-translatable";o=(o=document.getElementById(t)).nodeName,a(i).attr("id",t+"_"+e),a(i).attr("name",l+"_"+e),e!==WPGlobusCoreData.default_language&&(s+=" hidden"),a(i).attr("class",s),a(i).attr("data-save-to",t),a(i).attr("data-language",e),"INPUT"==o?a(i).attr("value",a("#wpglobus-link-tab-"+e).data(t)):"TEXTAREA"==o&&a(i).text(a("#wpglobus-link-tab-"+e).data(t)),n.addClass("hidden"),0==a(".wpglobus-element_"+t).length?a(i).insertAfter(n):a(i).insertAfter(a(".wpglobus-element_"+t).last())}(e,o)})}),a(".wpglobus-taxonomy-tabs").insertAfter("#ajax-response"),a(".wrap").tabs(),a("body").on("click",".wpglobus-taxonomy-tabs li",function(t){var e=a(this).data("language");a(".wpglobus-element").addClass("hidden"),a(".wpglobus-element_"+e).removeClass("hidden")}),a(".wpglobus-element").on("change",function(){var t=a(this).data("save-to"),e="";a(".wpglobus-element").each(function(o,n){var i=a(n),l=i.val();i.data("save-to")==t&&""!==l&&(e+=WPGlobusCore.addLocaleMarks(l,i.data("language")))}),a("#"+t).val(e)}),a(WPGlobusAdmin.data.multilingualSlug.title).insertAfter(".term-slug-wrap th label")},navMenus:function(){var t,e,o="#menu-to-edit .menu-item",n=function(){e!==a(o).length&&(clearInterval(t),a(o).each(function(t,e){var o=a(e);if(!o.hasClass("wpglobus-menu-item")){var n=a(e).attr("id");a.each(["input.edit-menu-item-title","input.edit-menu-item-attr-title"],function(t,e){var o=a("#"+n+" "+e),i=a(o);if(!i.hasClass("wpglobus-hidden")){i.addClass("wpglobus-hidden"),i.css("display","none");var l=i.parent("label"),s=i.parents("p");a(s).css("height","80px"),a(l).append('<div style="color:#f00;">'+WPGlobusAdmin.i18n.save_nav_menu+"</div>")}}),o.addClass("wpglobus-menu-item")}}))};a.ajaxSetup({beforeSend:function(i,l){void 0!==l.data&&l.data.indexOf("action=add-menu-item")>=0&&(e=a(o).length,t=setInterval(n,500))}}),a(o).each(function(t,e){var o=a(e).attr("id"),n=o.replace("menu-item-","");a.each(["input.edit-menu-item-title","input.edit-menu-item-attr-title"],function(t,e){var i=a("#"+o+" "+e);i.val()!=WPGlobusAdmin.data.items[n][e].source&&i.val(WPGlobusAdmin.data.items[n][e].source);var l=a("#"+o+" "+e).parents("p"),s=0;a.each(WPGlobusAdmin.data.open_languages,function(o,d){var u=i.clone();u.attr("id",i.attr("id")+"-"+d),u.attr("name",i.attr("id")+"-"+d),u.attr("data-language",d),u.attr("data-item-id",n),u.attr("placeholder",WPGlobusAdmin.data.en_language_name[d]);var r=WPGlobusAdmin.data.items[n][d][e].class;0===t&&d===WPGlobusAdmin.data.default_language?u.attr("class",r+" edit-menu-item-title"):u.attr("class",r),""!=WPGlobusAdmin.data.items[n][d][e].caption?u.attr("value",WPGlobusAdmin.data.items[n][d][e].caption):u.attr("value",""),u.css("margin-bottom","0.6em"),a(l).append(u),s=o}),s=40*(s+1),i.css("display","none").attr("class","").addClass("widefat wpglobus-hidden"),a(l).css("height",s+"px").addClass("wpglobus-menu-item-box")}),a(e).addClass("wpglobus-menu-item")}),a(".menus-move-left, .menus-move-right").each(function(t,e){var o,n=a(e),i=(n.parents("li").attr("id").replace("menu-item-",""),n.attr("title"));void 0!==i&&a.each(WPGlobusAdmin.data.post_titles,function(t,a){i.indexOf(t)>=0&&(o=i.replace(t,a),n.attr("title",o),n.text(o))})}),a(".edit-menu-item-title").trigger("change"),wpNavMenu.refreshAdvancedAccessibility(),wpNavMenu.menusChanged=!1,a(".wpglobus-menu-item").on("change",function(){var t,e,o=a(this),n=o.data("item-id");o.hasClass("wpglobus-item-title")&&(t=WPGlobusCore.getString(a("input#edit-menu-item-title-"+n).val(),o.val(),o.data("language")),void 0!==(e=a(document).triggerHandler("wpglobus_get_menu_translations",{string:t,lang:WPGlobusCoreData.open_languages,id:n,type:"input.edit-menu-item-title"}))&&(t=e),a("input#edit-menu-item-title-"+n).val(t)),o.hasClass("wpglobus-item-attr")&&(t=WPGlobusCore.getString(a("input#edit-menu-item-attr-title-"+n).val(),o.val(),o.data("language")),void 0!==(e=a(document).triggerHandler("wpglobus_get_menu_translations",{string:t,lang:WPGlobusCoreData.open_languages,id:n,type:"input.edit-menu-item-attr-title"}))&&(t=e),a("input#edit-menu-item-attr-title-"+n).val(t))})},postEdit:function(){a(document).on("heartbeat-send",function(t,e){void 0!==e.wp_autosave&&(e.wpglobus_heartbeat="wpglobus",a.each(WPGlobusAdmin.data.open_languages,function(t,o){var n=a("#title_"+o).val()||"";""!=(n=a.trim(n))&&(e.wp_autosave["post_title_"+o]=n),n=a("#content_"+o).val()||"",""!=(n=a.trim(n))&&(e.wp_autosave["content_"+o]=n)}))});var t="#postdivrich",e=!0,o="#post-body-content";if(!1===WPGlobusAdmin.data.support.editor&&(t="#titlediv",e=!1),!1===WPGlobusAdmin.data.support.title&&(e=!1),a(o).prepend(a(".wpglobus-post-body-tabs-list")),a.each(WPGlobusAdmin.tabs,function(o,n){"default"===n?(a(t).wrap('<div id="tab-default"></div>'),e&&a(a("#titlediv")).insertBefore(t)):(a(t+"-"+n).wrap('<div id="tab-'+n+'"></div>'),e&&a(a("#titlediv-"+n)).insertBefore(t+"-"+n))}),a(o).addClass("wpglobus-post-body-tabs").tabs({beforeActivate:function(t,e){var o=e.oldTab[0].id.replace("link-tab-",""),n=e.newTab[0].id.replace("link-tab-","");"default"==o&&(o=WPGlobusCoreData.default_language),"default"==n&&(n=WPGlobusCoreData.default_language);var i=a(document).triggerHandler("wpglobus_post_body_tabs",[o,n]);return!(!i&&void 0!==i)}}),a("#title").val(WPGlobusAdmin.title),a("#content").text(WPGlobusAdmin.content),"undefined"!=typeof WPGlobusVendor&&WPGlobusVendor.vendor.WPSEO&&("undefined"!=typeof wpglobus_wpseo?wpglobus_wpseo():"undefined"!=typeof WPGlobusYoastSeo&&("undefined"!=typeof WPGlobusYoastSeoPremium&&WPGlobusYoastSeoPremium&&WPGlobusYoastSeoPremium.init(),WPGlobusYoastSeo.init())),WPGlobusAdmin.data.modify_excerpt){var n=a("#excerpt");n.addClass("hidden").css({display:"none"}),a(WPGlobusAdmin.data.template).insertAfter(n),a("body").on("change",".wpglobus-excerpt",function(){var t=a(this);n.val(WPGlobusCore.getString(n.val(),t.val(),t.data("language")))})}if(void 0!==wp.utils&&void 0!==wp.utils.WordCounter){WPGlobusCoreData.wordCounter={};var i=this,l={};a.each(WPGlobusCoreData.enabled_languages,function(t,a){if(a==WPGlobusCoreData.default_language)return!0;l[t]="content_"+a,e=jQuery,o=new wp.utils.WordCounter,n=a,WPGlobusCoreData.wordCounter[n]={},WPGlobusCoreData.wordCounter[n].counter=o,e(function(){WPGlobusCoreData.wordCounter[n].content=e("#content_"+n),WPGlobusCoreData.wordCounter[n].count=e("#wp-word-count-"+n).find(".word-count-"+n),WPGlobusCoreData.wordCounter[n].prevCount=0;function t(t){var a,e;"object"==typeof t&&(t="tinymce"==t?i.getCurrentTab():t.target.id.replace("content_","")),void 0!==WPGlobusCoreData.wordCounter[t]&&(a=!WPGlobusCoreData.wordCounter[t].contentEditor||WPGlobusCoreData.wordCounter[t].contentEditor.isHidden()?WPGlobusCoreData.wordCounter[t].content.val():WPGlobusCoreData.wordCounter[t].contentEditor.getContent({format:"raw"}),(e=WPGlobusCoreData.wordCounter[t].counter.count(a))!==WPGlobusCoreData.wordCounter[t].prevCount&&WPGlobusCoreData.wordCounter[t].count.text(e),WPGlobusCoreData.wordCounter[t].prevCount=e)}e(document).on("tinymce-editor-init",function(a,o){if(-1!=e.inArray(o.id,l)){var n=o.id.replace("content_","");WPGlobusCoreData.wordCounter[n].contentEditor=o,o.on("nodechange keyup",_.debounce(t,1e3))}}),WPGlobusCoreData.wordCounter[n].content.on("input keyup",_.debounce(t,1e3)),t(n)});var e,o,n})}a(document).on("click","#publish, #save-post",function(){if(WPGlobusAdmin.data.open_languages.length>1){a(document).triggerHandler("wpglobus_before_save_post",{content_tabs_id:o});var t,e=a("#title").val(),n="",i="";0==e.length&&(t=WPGlobusAdmin.data.open_languages.indexOf(WPGlobusAdmin.data.default_language),WPGlobusAdmin.data.open_languages.splice(t,1),a(WPGlobusAdmin.data.open_languages).each(function(t,o){i=0==t?"":"-",(e=a("#title_"+o).val()).length>0&&(0==n.length&&(i=""),n=n+i+e)})),n.length>0&&a("#title").val(n)}void 0===WPGlobusAdmin.data.tagsdiv||WPGlobusAdmin.data.tagsdiv.length<1||a(WPGlobusAdmin.data.tagsdiv).each(function(t,e){if(0==a("#"+e).length)return!0;var o=e.replace("tagsdiv-","");if("undefined"===o)return!0;if(0==a("#tax-input-"+o).length)return!0;var n,i=[];a("#tagsdiv-"+o+" .tagchecklist > span").each(function(t,e){n=(n=a(e).html()).replace(/<button.*<\/button>&nbsp;/,""),void 0===WPGlobusAdmin.data.tag[o][n]?i[t]=n:i[t]=WPGlobusAdmin.data.tag[o][n]}),a("#tax-input-"+o).val(i.join(", "))})}),a(".ui-state-default").on("click",function(){"link-tab-default"===a(this).attr("id")&&(a(window).scrollTop(a(window).scrollTop()+1),a(window).scrollTop(a(window).scrollTop()-1))}),a(document).on("tabsactivate",o,function(t,a){WPGlobusAdmin.currentTab=a.newTab[0].dataset.language}),a(document).triggerHandler("wpglobus_after_post_edit")},adminCentral:function(){a(".wpglobus-admin-central-tab").css({display:"none"}),a(".nav-tab-active").length>1&&a(".wpglobus-about-wrap .nav-tab-wrapper a").removeClass("nav-tab-active");var t=!0;0==location.hash.indexOf("#")&&a(".wpglobus-about-wrap .nav-tab-wrapper a").each(function(e,o){a(o).attr("href")==location.hash&&(t=!1,a(o).addClass("nav-tab-active"))}),t&&a(".wpglobus-about-wrap .nav-tab-wrapper a").eq(0).addClass("nav-tab-active");var e=a(".wpglobus-about-wrap .nav-tab-active").data("tab-id");""!=e&&a("#"+e).css({display:"block"}),a(document).on("click",".wpglobus-about-wrap .nav-tab",function(t){var e=a(this);e.hasClass("nav-tab-active")||(a(".wpglobus-admin-central-tab").css({display:"none"}),a(".wpglobus-about-wrap .nav-tab").removeClass("nav-tab-active"),e.addClass("nav-tab-active"),""!=e.data("tab-id")&&a("#"+e.data("tab-id")).css({display:"block"}))})},start:function(){var t=this;a("#wpglobus_flags").select2({formatResult:this.format,formatSelection:this.format,minimumResultsForSearch:-1,escapeMarkup:function(t){return t}}),a("body").on("click","#enabled_languages-list li:first input",function(e){return e.preventDefault(),a(".redux-save-warn").css({display:"none"}),a("#enabled_languages-list").find("li:first > input").val("1"),0===a("#disable_first_language").length&&a(t.config.disable_first_language).insertAfter("#info_bar"),!1})},format:function(t){return'<img class="wpglobus_flag" src="'+WPGlobusAdmin.flag_url+t.text+'"/>&nbsp;&nbsp;'+t.text},set_dialog:function(){if(void 0===WPGlobusAdmin.data.customFieldsEnabled||(WPGlobusAdmin.data.customFieldsEnabled=this.parseBool(WPGlobusAdmin.data.customFieldsEnabled),WPGlobusAdmin.data.customFieldsEnabled)){var t,e=!1,o=function(t){var o,n,i,l="wpglobus_dialog_start wpglobus_dialog_icon";i=['<div class="wpglobus_dialog_options_wrapper hidden">','<input style="width:initial;" id="wpglobus-cb-{{id}}" data-object="#wpglobus-dialog-start-{{id}}" data-meta-key="{{meta-key}}" class="wpglobus_dialog_option wpglobus_dialog_cb" type="checkbox" {{checked}} />',"</div>"].join(""),a(void 0===t?"#the-list tr":"#the-list tr#"+t).each(function(){var t,e,s,d=a(this),u=d.attr("id"),r=d.find("textarea"),c=l;if(void 0===(o=r.attr("id")))return!0;s=a("#"+u+"-key").val(),t=a("#"+o).clone(),a(r).addClass("wpglobus-dialog-field-source hidden"),e=r.attr("name"),a(t).attr("id","wpglobus-"+o),a(t).attr("name","wpglobus-"+e),a(t).attr("data-source-id",o),a(t).attr("class","wpglobus-dialog-field"),a(t).val(WPGlobusCore.TextFilter(a(r).val(),WPGlobusCoreData.language)),a(t).insertAfter(r),n=(n=i.replace(/{{id}}/g,o)).replace(/{{meta-key}}/g,s),void 0===WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type]?n=n.replace(/{{checked}}/,"checked"):void 0!==WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][s]&&"false"==WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][s]?(n=n.replace(/{{checked}}/,""),c=l+" wpglobus_dialog_start_hidden"):(n=n.replace(/{{checked}}/,"checked"),c=l),d.append('<td style="width:20px;"><div id="wpglobus-dialog-start-'+o+'" data-type="control" data-source-type="textarea" data-source-id="'+o+'" class="'+c+'"></div>'+n+"</td>")}),!e&&a("#list-table .wpglobus_dialog_start").length>0&&(a("#list-table thead tr").append('<th class="wpglobus-control-head"><div class="wpglobus_dialog_settings wpglobus_dialog_icon"></div></th>'),e=!0)};o(),a("body").on("change",".wpglobus-dialog-field",function(){var t,e=a(this),o="#"+e.data("source-id"),n="",i="";void 0!==o&&(n=a(o).val(),/(\{:|\[:|<!--:)[a-z]{2}/.test(n)?(a.each(WPGlobusCoreData.enabled_languages,function(a,o){""!=(t=o==WPGlobusCoreData.language?e.val():WPGlobusCore.TextFilter(n,o,"RETURN_EMPTY"))&&(i+=WPGlobusCore.addLocaleMarks(t,o))}),a(o).val(i)):a(o).val(e.val()))}),a(document).ajaxSend(function(a,e,o){"add-meta"==o.action&&(t=o.element)}),a(document).ajaxComplete(function(e,n,i){"add-meta"==i.action&&void 0!==n.responseXML&&o("newmeta"==t?"meta-"+a(n.responseXML.documentElement.outerHTML).find("meta").attr("id"):t)}),WPGlobusDialogApp.init({dialogTitle:"Edit meta"})}}},new t.App,t);var t,a});
1
+ var WPGlobusCore,WPGlobusDialogApp;!function(i){var d;d=WPGlobusCore={strpos:function(t,a,e){var o=(t=""+t).indexOf(a,e);return 0<=o&&o},TextFilter:function(t,a,e){if(void 0===t||""===t)return t;var o,n,i=[],l=!1;a=""==a?"en":a,e=void 0===e||""==e?"RETURN_IN_DEFAULT_LANGUAGE":e,i[0]=[],i[0].start=WPGlobusCoreData.locale_tag_start.replace("%s",a),i[0].end=WPGlobusCoreData.locale_tag_end,i[1]=[],i[1].start="\x3c!--:"+a+"--\x3e",i[1].end="\x3c!--:--\x3e",i[2]=[],i[2].start="[:"+a+"]",i[2].end="[:";for(var s=0;s<3;s++)if(!1!==(o=d.strpos(t,i[s].start))){o+=i[s].start.length,t=!1===(n=d.strpos(t,i[s].end,o))?t.substr(o):t.substr(o,n-o),l=!0;break}return l||("RETURN_EMPTY"==e?(a!=WPGlobusCoreData.default_language||/(\{:|\[:|<!--:)[a-z]{2}/.test(t))&&(t=""):a==WPGlobusCoreData.default_language?/(\{:|\[:|<!--:)[a-z]{2}/.test(t)&&(t=""):t=d.TextFilter(t,WPGlobusCoreData.default_language)),t},addLocaleMarks:function(t,a){return WPGlobusCoreData.locale_tag_start.replace("%s",a)+t+WPGlobusCoreData.locale_tag_end},getTranslations:function(e){var o,n={};return i.each(WPGlobusCoreData.enabled_languages,function(t,a){o=a==WPGlobusCoreData.default_language?"RETURN_IN_DEFAULT_LANGUAGE":"RETURN_EMPTY",n[a]=d.TextFilter(e,a,o)}),n},getString:function(t,a,e){if(void 0===t)return t;void 0===a&&(a=""),void 0===e&&(e=WPGlobusCoreData.language),(t=d.getTranslations(t))[e]=a;var o="";return i.each(t,function(t,a){""!=a&&t!=WPGlobusCoreData.default_language&&(o+=d.addLocaleMarks(a,t))}),""!=t[WPGlobusCoreData.default_language]&&(o=""==o?t[WPGlobusCoreData.default_language]:d.addLocaleMarks(t[WPGlobusCoreData.default_language],WPGlobusCoreData.default_language)+o),o}}}(jQuery),function(m){var v;v=WPGlobusDialogApp={option:{listenClass:".wpglobus_dialog_start",settingsClass:".wpglobus_dialog_settings",dialogTabs:"#wpglobus-dialog-tabs",dialogTitle:"",customData:null,callback:function(){},dialogOptions:{title:"",placeholder:"",formFooter:"",beforeOpen:function(){},close:function(){}},dialog:{}},form:void 0,element:void 0,element_by:"id",id:"",clone_id:"",wpglobus_id:"",type:"textarea",source:"",order:{},value:{},request:"core",attrs:{},dialogTitle:"",trClass:"wpglobus-translatable",startButton:['<span id="wpglobus-dialog-start-{{clone_id}}" ','style="{{style}}" ','data-type="control" data-dialog-title="{{title}}" ','data-source-type="" data-source-id="{{id}}" data-source-name="{{name}}" ','data-nodename="{{nodename}}"',"{{sbTitle}} ",'class="{{classes}}"></span>'].join(""),startButtonClass:"wpglobus_dialog_start wpglobus_dialog_icon",clicks:0,init:function(t){v.option.dialog=v.option.dialogOptions,v.option=m.extend(v.option,t),m(v.option.dialogTabs).tabs(),v.dialogTitle=v.option.dialogTitle,this.attachListener(),null!=v.option.customData&&void 0!==v.option.customData.addElements&&m.each(v.option.customData.addElements,function(t,a){v.addElement(a)})},convertToId:function(t){return t=(t=t.replace(/\]/g,"")).replace(/\[/g,"-")},addElement:function(t){var a={id:null,style:"",styleTextareaWrapper:"",sbTitle:"",onChangeClass:"",dialogTitle:"",dialog:v.option.dialogOptions};if("string"==typeof t)a.id=t;else{if("object"!=typeof t)return;a=m.extend(a,t)}var e,o,n,i=null,l=null,s=null,d=null,u=v.startButton,r="";if(v.element_by="name",0==(d=document.getElementsByName(a.id)).length&&(v.element_by="id",d=document.getElementById(a.id)),null!==d){if(l=a.id,"id"==v.element_by?i=m("#"+l):(r=(r=d[0].nodeName).toLowerCase(),i=m(r+'[name="'+l+'"]')),s=void 0===i.attr("name")||""==i.attr("name")?l:i.attr("name"),v.clone_id=v.convertToId(l),-1!=s.indexOf("wpglobus")||-1!=v.clone_id.indexOf("wpglobus"))return!1;if(0<m("#wpglobus-"+v.clone_id).length)return!1;if(0<m(r+'[name="wpglobus-'+s+'"]').length)return!1;e=m(i.clone()),n=i.attr("style")||"",i.attr("style","display:none;"),e.attr("id","wpglobus-"+v.clone_id).attr("name","wpglobus-"+s),e.addClass(v.trClass),""!=a.onChangeClass&&e.addClass(a.onChangeClass),"id"==v.element_by?e.attr("data-source-id",l).attr("data-source-name","").attr("data-source-get-by",v.element_by):e.attr("data-source-id","").attr("data-source-name",s).attr("data-source-get-by",v.element_by),"textarea"==r?(o=WPGlobusCore.getTranslations(i.val())[WPGlobusCoreData.language],e.val(o),e.attr("data-nodename","textarea"),""==a.style?e.attr("style",n+";width:95%;float:left;"):e.attr("style",n+";"+a.style)):(o=WPGlobusCore.getTranslations(i.val())[WPGlobusCoreData.language],e.attr("value",o),e.attr("data-nodename","input"),""!=a.style&&e.attr("style",n+";"+a.style)),""!=a.dialog&&e.attr("data-dialog",JSON.stringify(a.dialog)),u=u.replace(/{{clone_id}}/g,v.clone_id),u="id"==v.element_by?(u=(u=u.replace(/{{id}}/g,v.clone_id)).replace(/{{name}}/g,"")).replace(/{{nodename}}/g,""):(u=(u=u.replace(/{{id}}/g,"")).replace(/{{name}}/g,s)).replace(/{{nodename}}/g,r),u="textarea"==r?u.replace("{{style}}","float:left;margin-top:0;"):u.replace("{{style}}","");var c="textarea"==r?v.startButtonClass+" wpglobus-textarea wpglobus-textarea-"+v.clone_id:v.startButtonClass;u=u.replace("{{classes}}",c),u=""==a.dialogTitle?u.replace("{{title}}",v.dialogTitle):u.replace("{{title}}",a.dialogTitle),u=""==a.sbTitle?u.replace("{{sbTitle}}",a.sbTitle):u.replace("{{sbTitle}}",'title="'+a.sbTitle+'"'),m(u).insertAfter(i),m(e).insertAfter(i),"textarea"==r&&(m("#wpglobus-"+v.clone_id).addClass("wpglobus-textarea-"+v.clone_id),m(".wpglobus-textarea-"+v.clone_id).wrapAll('<div class="wpglobus-textarea-wrapper" style="'+a.styleTextareaWrapper+'"></div>'));var g,b=!1;if(""==a.onChangeClass)g="#wpglobus-"+v.clone_id;else{g="."+a.onChangeClass;var p=m._data(m(document)[0],"events");void 0===p?b=!0:void 0!==p.change&&m.each(p.change,function(t,a){if(a.selector==g)return b=!0,!1})}return b||m(document).on("change",g,function(){var t=m(this),a=t.data("source-id");a=""==a?t.data("nodename")+'[name="'+t.data("source-name")+'"]':"#"+a,m(a).val(WPGlobusCore.getString(m(a).val(),t.val()))}),!0}},saveDialog:function(){var e,o,n,i="",l="",s="";m(".wpglobus_dialog_textarea").each(function(t,a){e=m(a),o=e.val(),(n=e.data("language"))==WPGlobusAdmin.data.language&&(s=o),""!=o&&(i+=WPGlobusCore.addLocaleMarks(o,n),n==WPGlobusCoreData.default_language&&(l=o))}),i=i.length==l.length+8?l:i,m(v.id).val(i),i=""==s?l:s,m(v.wpglobus_id).val(i)},dialog:m("#wpglobus-dialog-wrapper").dialog({autoOpen:!1,width:650,modal:!0,dialogClass:"wpglobus-dialog",buttons:[{text:"Save",class:"wpglobus-button-save",click:function(){v.saveDialog(),v.dialog.dialog("close")}},{text:"Cancel",class:"wpglobus-button-cancel",click:function(){v.dialog.dialog("close")}}],open:function(t,a){var e=v.dialogTitle;void 0!==v.attrs.maxlength&&(m(".wpglobus_dialog_textarea").attr("maxlength",v.attrs.maxlength),e+=" | maxlength="+v.attrs.maxlength),m(".wpglobus-dialog .ui-dialog-title").text(e)},close:function(){v.runCallback(v.option.dialog.close),v.form[0].reset()}}),attachListener:function(){m(document).on("click",v.option.settingsClass,function(){m(".wpglobus_dialog_options_wrapper").hasClass("hidden")?m(".wpglobus_dialog_options_wrapper").removeClass("hidden"):m(".wpglobus_dialog_options_wrapper").addClass("hidden")}),m(document).on("click",".wpglobus_dialog_option",function(t){var a=m(this),e=a.data("object");v.order.action="save_post_meta_settings",v.order.post_type=WPGlobusAdmin.data.post_type,v.order.checked=a.prop("checked"),v.order.id=a.attr("id"),v.order.meta_key=a.data("meta-key"),v.ajax(v.order).done(function(t){"ok"==t.result&&("true"==t.checked?m(e).removeClass("wpglobus_dialog_start_hidden"):m(e).addClass("wpglobus_dialog_start_hidden"))}).fail(function(t){}).always(function(t,a){})}),m(document).on("click",v.option.listenClass,function(a){v.element=m(this),v.id=v.element.data("source-id"),""==v.id?(v.id=v.element.data("nodename")+'[name="'+v.element.data("source-name")+'"]',v.wpglobus_id="#wpglobus-"+v.convertToId(v.element.data("source-name"))):(v.wpglobus_id="#wpglobus-"+v.id,v.id="#"+v.id),v.clicks++,1==v.clicks&&setTimeout(function(){if(1==v.clicks)v.onClick(a);else{var t=m(v.id);t.hasClass("hidden")?t.removeClass("hidden").attr("style","display:block;"):t.addClass("hidden").attr("style","display:none;")}v.clicks=0},200)}),v.form=v.dialog.find("form#wpglobus-dialog-form").on("submit",function(t){t.preventDefault(),v.saveDialog()})},ajax:function(t){return m.ajax({type:"POST",url:WPGlobusAdmin.ajaxurl,data:{action:WPGlobusAdmin.process_ajax,order:t},dataType:"json",async:!1})},onClick:function(t){void 0===v.element.data("dialog-title")||""==v.element.data("dialog-title")?v.dialogTitle=v.option.dialogTitle:v.dialogTitle=v.element.data("dialog-title"),void 0!==v.id&&(v.attrs.maxlength=m(v.id).attr("maxlength")),v.source=v.element.data("source-value"),void 0===v.source&&(v.source=m(v.id).val(),"ajax"==v.request||(v.value=WPGlobusCore.getTranslations(v.source))),v.option.dialog=m.extend({},v.option.dialogOptions,m(v.wpglobus_id).data("dialog")),""!=v.option.dialog.title&&(v.dialogTitle=v.option.dialog.title),m.each(v.value,function(t,a){var e=m("#wpglobus-dialog-"+t);e.val(a),e.attr("placeholder",WPGlobusCore.TextFilter(v.option.dialog.placeholder,t,"RETURN_IN_DEFAULT_LANGUAGE"))}),m("#wpglobus-dialog-form-footer").html(v.option.dialog.formFooter),v.runCallback(v.option.dialog.beforeOpen),v.dialog.dialog("open")},runCallback:function(t){if("object"==typeof t){var a=Object.keys(t)[0],e=t[Object.keys(t)[0]];"window"===a?"function"==typeof window[e]&&window[e](t[Object.keys(t)[1]]):"function"==typeof window[a][e]&&window[a][e](t[Object.keys(t)[1]])}else"string"==typeof t&&"function"==typeof window[t]&&window[t]()}}}(jQuery),jQuery(document).ready(function(){"use strict";var t,c;window.WPGlobusAdminApp=(t=window.WPGlobusAdminApp||{},c=jQuery,t.App=function(t){void 0===window.WPGlobusAdminApp&&(this.config={debug:!1,version:WPGlobusAdmin.version},this.status="ok","undefined"==typeof WPGlobusAdmin?(this.status="error",this.config.debug&&console.log("WPGlobus: error options loading")):this.config.debug&&console.dir(WPGlobusAdmin),this.config.disable_first_language=['<div id="disable_first_language" style="display:block;" class="redux-field-errors notice-red">',"<strong>","<span>&nbsp;</span>",WPGlobusAdmin.i18n.cannot_disable_language,"</strong>","</div>"].join(""),c.extend(this.config,t),"ok"===this.status&&this.init())},t.App.prototype={$document:c(document),init:function(){WPGlobusCoreData.multisite=this.parseBool(WPGlobusCoreData.multisite),this.adminInit(),c("#content").addClass("wpglobus-editor").attr("data-language",WPGlobusAdmin.data.default_language),c("textarea[id^=content_]").each(function(t,a){var e=c(a).attr("id").replace("content_","");c(a).attr("data-language",e)}),"post.php"===WPGlobusAdmin.page?(this.postEdit(),this.set_dialog(),"undefined"!=typeof WPGlobusAioseop&&WPGlobusAioseop.init()):"menu-edit"===WPGlobusAdmin.page?this.navMenus():"taxonomy-edit"===WPGlobusAdmin.page?WPGlobusAdmin.data.tag_id&&this.taxonomyEdit():"taxonomy-quick-edit"===WPGlobusAdmin.page?this.quickEdit("taxonomy"):"edit.php"===WPGlobusAdmin.page?this.quickEdit("post"):"options-general.php"==WPGlobusAdmin.page?this.optionsGeneral():"widgets.php"==WPGlobusAdmin.page?(WPGlobusWidgets.init(),WPGlobusDialogApp.init({dialogTitle:"Edit text"})):"wpglobus_options"==WPGlobusAdmin.page?this.start():"wpglobusAdminCentral"==WPGlobusAdmin.page?this.adminCentral():WPGlobusDialogApp.init({customData:WPGlobusCoreData.page_custom_data})},parseBool:function(t){return!/^(false|0)$/i.test(t)&&!!t},getCurrentTab:function(){return c(".wpglobus-post-body-tabs-list .ui-tabs-active").data("language")},adminInit:function(){var t=c(".wpglobus-addons-group a").data("key");if(void 0!==t)if(0<=window.location.search.indexOf("page=wpglobus_options&tab="+t))WPGlobusCoreData.multisite?window.location=WPGlobusCoreData.pluginInstallLocation.multisite:window.location=WPGlobusCoreData.pluginInstallLocation.single;else{var a=c("#toplevel_page_wpglobus_options li").eq(t+1);WPGlobusCoreData.multisite?c(a).find("a").attr("href",WPGlobusCoreData.pluginInstallLocation.multisite).attr("onclick","window.location=jQuery(this).attr('href');return false;"):c(a).find("a").attr("href",WPGlobusCoreData.pluginInstallLocation.single).attr("onclick","window.location=jQuery(this).attr('href');return false;")}},optionsGeneral:function(){var o=c("#blogname"),t=c("body");o.addClass("hidden"),c("#wpglobus-blogname").insertAfter(o).removeClass("hidden"),t.on("blur",".wpglobus-blogname",function(){c(".wpglobus-blogname").each(function(t,a){var e=c(a);o.val(WPGlobusCore.getString(o.val(),e.val(),e.data("language")))})});var n=c("#blogdescription");n.addClass("hidden"),c("#wpglobus-blogdescription").insertAfter(n).removeClass("hidden"),t.on("blur",".wpglobus-blogdesc",function(){c(".wpglobus-blogdesc").each(function(t,a){var e=c(a);n.val(WPGlobusCore.getString(n.val(),e.val(),e.data("language")))})})},quickEdit:function(n){if(void 0!==WPGlobusAdmin.data.has_items&&WPGlobusAdmin.data.has_items){var o="",l=0;c(document).ajaxComplete(function(t,a,e){void 0!==e.data&&""!=o&&0<=e.data.indexOf("action=inline-save-tax&")&&(c("#"+o+" a.row-title").text(WPGlobusAdmin.qedit_titles[l][WPGlobusAdmin.data.language].name),c("#"+o+" .description").text(WPGlobusAdmin.qedit_titles[l][WPGlobusAdmin.data.language].description))});var i={};c("#the-list tr").each(function(t,a){var e=c(a),o="post"===n?"post-":"tag-";l=e.attr("id").replace(o,""),i[l]={},"post"===n?i[l].source=e.find(".post_title").text():"taxonomy"===n&&(i[l].source=c("#inline_"+l+" .name").text())});var t={action:"get_titles"};t.type=n,t.taxonomy=void 0!==WPGlobusAdmin.data.taxonomy&&WPGlobusAdmin.data.taxonomy,t.title=i,c.ajax({type:"POST",url:WPGlobusAdmin.ajaxurl,data:{action:WPGlobusAdmin.process_ajax,order:t},dataType:"json"}).done(function(t){WPGlobusAdmin.qedit_titles=t.qedit_titles,c.each(t.bulkedit_post_titles,function(t,a){c("#inline_"+t+" .post_title").text(a[WPGlobusAdmin.data.language].name)})}).fail(function(t){}).always(function(t,a){}),c("body").on("change",".wpglobus-quick-edit-title",function(){var n="",i=[];c(".wpglobus-quick-edit-title").each(function(t,a){var e=c(a),o=e.data("language");""!==e.val()&&(n=WPGlobusCore.getString(n,e.val(),o)),WPGlobusAdmin.qedit_titles[l][o].name=e.val(),i[t]=o});var t=c(document).triggerHandler("wpglobus_get_translations",{string:n,lang:i,id:l});void 0!==t&&(n=t),c("input.ptitle").eq(0).attr("value",n),WPGlobusAdmin.qedit_titles[l].source=n}),void 0!==WPGlobusAdmin.data.tags&&c.each(WPGlobusAdmin.data.tags,function(t,a){WPGlobusAdmin.data.value[a].post_id={}}),c("button.save, input#bulk_edit").on("mouseenter",function(t){void 0!==WPGlobusAdmin.data.tags&&("bulk_edit"==t.currentTarget.id?c("input#bulk_edit").unbind("click"):c("button.save").unbind("click"),c("button.save, input#bulk_edit").on("click",function(a){var t=c.when(),e=(c(this),c.Deferred());e.resolve(function(t){t.next(".spinner").css({visibility:"visible"}),"bulk_edit"!=a.currentTarget.id&&c.ajaxSetup({async:!1});var o,n,i,l=t.parents("tr"),s=l.attr("id").replace("edit-","");c.each(WPGlobusAdmin.data.tags,function(t,a){if(0==(o=l.find("textarea[name='"+WPGlobusAdmin.data.names[a]+"']")).length)return!0;WPGlobusAdmin.data.value[a].post_id[s]=o.val(),n=WPGlobusAdmin.data.value[a].post_id[s].split(","),i=[];for(var e=0;e<n.length;e++)n[e]=n[e].trim(" "),""!=n[e]&&(void 0===WPGlobusAdmin.data.tag[a][n[e]]?i[e]=n[e]:i[e]=WPGlobusAdmin.data.tag[a][n[e]]);o.val(i.join(", "))})}(c(this))),t=t.then(function(){return c.when(e.done())}).then(function(){"bulk_edit"!=a.currentTarget.id&&setTimeout(function(){inlineEditPost.save(l),c.ajaxSetup({async:!0})},50)})}))}),c("#the-list").on("click","a.editinline",function(){var t=c(this);if(o=t.parents("tr").attr("id"),"post"===n)l=o.replace("post-","");else{if("taxonomy"!==n)return;l=o.replace("tag-","")}"post"===n&&void 0!==WPGlobusAdmin.data.tags&&c.each(WPGlobusAdmin.data.tags,function(t,a){if(""!=WPGlobusAdmin.data.value[a]){var e,o=c("#edit-"+l+' textarea[name="'+WPGlobusAdmin.data.names[a]+'"]').val();void 0!==o&&(e=o.split(","),c.each(e,function(t,a){o=o.replace(a,WPGlobusCore.TextFilter(a,WPGlobusCoreData.language))}),c("#edit-"+l+' textarea[name="'+WPGlobusAdmin.data.names[a]+'"]').val(o))}});var a=c("#edit-"+l+" input.ptitle").eq(0),e=a.parents("label");a.val(WPGlobusAdmin.qedit_titles[l].source),a.addClass("hidden"),c(WPGlobusAdmin.data.template).insertAfter(e),void 0===WPGlobusAdmin.qedit_titles[l]&&(WPGlobusAdmin.qedit_titles[l]={},WPGlobusAdmin.qedit_titles[l].source=c("#"+o+" .name a.row-title").text(),c(WPGlobusAdmin.data.enabled_languages).each(function(t,a){WPGlobusAdmin.qedit_titles[l][a]={},a==WPGlobusAdmin.data.default_language?WPGlobusAdmin.qedit_titles[l][a].name=WPGlobusAdmin.qedit_titles[l].source:WPGlobusAdmin.qedit_titles[l][a].name="",WPGlobusAdmin.qedit_titles[l][a].description=""})),c(".wpglobus-quick-edit-title").each(function(t,a){var e=c(a),o=e.data("language");e.attr("id",o+l),void 0!==WPGlobusAdmin.qedit_titles[l][o]&&(WPGlobusAdmin.qedit_titles[l][o].name=WPGlobusAdmin.qedit_titles[l][o].name.replace(/\\\'/g,"'"),WPGlobusAdmin.qedit_titles[l][o].name=WPGlobusAdmin.qedit_titles[l][o].name.replace(/\\\"/g,'"'),e.attr("value",WPGlobusAdmin.qedit_titles[l][o].name),WPGlobusAdmin.qedit_titles[l].source=WPGlobusCore.getString(WPGlobusAdmin.qedit_titles[l].source,WPGlobusAdmin.qedit_titles[l][o].name,o))}),c("input.ptitle").eq(0).attr("value",WPGlobusAdmin.qedit_titles[l].source)})}},taxonomyEdit:function(){var a=[];a[0]="name",a[1]="description",c.each(WPGlobusCoreData.enabled_languages,function(t,u){c.each(a,function(t,a){var e,o,n,i,l,s,d;o=u,i=c("#"+(e=a)),l=i.clone(),s=i.attr("name"),d="wpglobus-element wpglobus-element_"+e+" wpglobus-element_"+o+" wpglobus-translatable",n=(n=document.getElementById(e)).nodeName,c(l).attr("id",e+"_"+o),c(l).attr("name",s+"_"+o),o!==WPGlobusCoreData.default_language&&(d+=" hidden"),c(l).attr("class",d),c(l).attr("data-save-to",e),c(l).attr("data-language",o),"INPUT"==n?c(l).attr("value",c("#wpglobus-link-tab-"+o).data(e)):"TEXTAREA"==n&&c(l).text(c("#wpglobus-link-tab-"+o).data(e)),i.addClass("hidden"),0==c(".wpglobus-element_"+e).length?c(l).insertAfter(i):c(l).insertAfter(c(".wpglobus-element_"+e).last())})}),c(".wpglobus-taxonomy-tabs").insertAfter("#ajax-response"),c(".wrap").tabs(),c("body").on("click",".wpglobus-taxonomy-tabs li",function(t){var a=c(this).data("language");c(".wpglobus-element").addClass("hidden"),c(".wpglobus-element_"+a).removeClass("hidden")}),c(".wpglobus-element").on("change",function(){var n=c(this).data("save-to"),i="";c(".wpglobus-element").each(function(t,a){var e=c(a),o=e.val();e.data("save-to")==n&&""!==o&&(i+=WPGlobusCore.addLocaleMarks(o,e.data("language")))}),c("#"+n).val(i)}),c(WPGlobusAdmin.data.multilingualSlug.title).insertAfter(".term-slug-wrap th label")},navMenus:function(){var e,o,n="#menu-to-edit .menu-item",i=function(){o!==c(n).length&&(clearInterval(e),c(n).each(function(t,a){var e=c(a);if(!e.hasClass("wpglobus-menu-item")){var l=c(a).attr("id");c.each(["input.edit-menu-item-title","input.edit-menu-item-attr-title"],function(t,a){var e=c("#"+l+" "+a),o=c(e);if(!o.hasClass("wpglobus-hidden")){o.addClass("wpglobus-hidden"),o.css("display","none");var n=o.parent("label"),i=o.parents("p");c(i).css("height","80px"),c(n).append('<div style="color:#f00;">'+WPGlobusAdmin.i18n.save_nav_menu+"</div>")}}),e.addClass("wpglobus-menu-item")}}))};c.ajaxSetup({beforeSend:function(t,a){void 0!==a.data&&0<=a.data.indexOf("action=add-menu-item")&&(o=c(n).length,e=setInterval(i,500))}}),c(n).each(function(t,a){var e=c(a).attr("id"),u=e.replace("menu-item-","");c.each(["input.edit-menu-item-title","input.edit-menu-item-attr-title"],function(n,i){var l=c("#"+e+" "+i);l.val()!=WPGlobusAdmin.data.items[u][i].source&&l.val(WPGlobusAdmin.data.items[u][i].source);var s=c("#"+e+" "+i).parents("p"),d=0;c.each(WPGlobusAdmin.data.open_languages,function(t,a){var e=l.clone();e.attr("id",l.attr("id")+"-"+a),e.attr("name",l.attr("id")+"-"+a),e.attr("data-language",a),e.attr("data-item-id",u),e.attr("placeholder",WPGlobusAdmin.data.en_language_name[a]);var o=WPGlobusAdmin.data.items[u][a][i].class;0===n&&a===WPGlobusAdmin.data.default_language?e.attr("class",o+" edit-menu-item-title"):e.attr("class",o),""!=WPGlobusAdmin.data.items[u][a][i].caption?e.attr("value",WPGlobusAdmin.data.items[u][a][i].caption):e.attr("value",""),e.css("margin-bottom","0.6em"),c(s).append(e),d=t}),d=40*(d+1),l.css("display","none").attr("class","").addClass("widefat wpglobus-hidden"),c(s).css("height",d+"px").addClass("wpglobus-menu-item-box")}),c(a).addClass("wpglobus-menu-item")}),c(".menus-move-left, .menus-move-right").each(function(t,a){var e,o=c(a),n=(o.parents("li").attr("id").replace("menu-item-",""),o.attr("title"));void 0!==n&&c.each(WPGlobusAdmin.data.post_titles,function(t,a){0<=n.indexOf(t)&&(e=n.replace(t,a),o.attr("title",e),o.text(e))})}),c(".edit-menu-item-title").trigger("change"),wpNavMenu.refreshAdvancedAccessibility(),wpNavMenu.menusChanged=!1,c(".wpglobus-menu-item").on("change",function(){var t,a,e=c(this),o=e.data("item-id");e.hasClass("wpglobus-item-title")&&(t=WPGlobusCore.getString(c("input#edit-menu-item-title-"+o).val(),e.val(),e.data("language")),void 0!==(a=c(document).triggerHandler("wpglobus_get_menu_translations",{string:t,lang:WPGlobusCoreData.open_languages,id:o,type:"input.edit-menu-item-title"}))&&(t=a),c("input#edit-menu-item-title-"+o).val(t)),e.hasClass("wpglobus-item-attr")&&(t=WPGlobusCore.getString(c("input#edit-menu-item-attr-title-"+o).val(),e.val(),e.data("language")),void 0!==(a=c(document).triggerHandler("wpglobus_get_menu_translations",{string:t,lang:WPGlobusCoreData.open_languages,id:o,type:"input.edit-menu-item-attr-title"}))&&(t=a),c("input#edit-menu-item-attr-title-"+o).val(t))})},postEdit:function(){c(document).on("heartbeat-send",function(t,o){void 0!==o.wp_autosave&&(o.wpglobus_heartbeat="wpglobus",c.each(WPGlobusAdmin.data.open_languages,function(t,a){var e=c("#title_"+a).val()||"";""!=(e=c.trim(e))&&(o.wp_autosave["post_title_"+a]=e),e=c("#content_"+a).val()||"",""!=(e=c.trim(e))&&(o.wp_autosave["content_"+a]=e)}))});var e="#postdivrich",o=!0,a="#post-body-content";if(!1===WPGlobusAdmin.data.support.editor&&(e="#titlediv",o=!1),!1===WPGlobusAdmin.data.support.title&&(o=!1),c(a).prepend(c(".wpglobus-post-body-tabs-list")),c.each(WPGlobusAdmin.tabs,function(t,a){"default"===a?(c(e).wrap('<div id="tab-default"></div>'),o&&c(c("#titlediv")).insertBefore(e)):(c(e+"-"+a).wrap('<div id="tab-'+a+'"></div>'),o&&c(c("#titlediv-"+a)).insertBefore(e+"-"+a))}),c(a).addClass("wpglobus-post-body-tabs").tabs({beforeActivate:function(t,a){var e=a.oldTab[0].id.replace("link-tab-",""),o=a.newTab[0].id.replace("link-tab-","");"default"==e&&(e=WPGlobusCoreData.default_language),"default"==o&&(o=WPGlobusCoreData.default_language);var n=c(document).triggerHandler("wpglobus_post_body_tabs",[e,o]);return!(!n&&void 0!==n)}}),c("#title").val(WPGlobusAdmin.title),c("#content").text(WPGlobusAdmin.content),"undefined"!=typeof WPGlobusVendor&&WPGlobusVendor.vendor.WPSEO&&("undefined"!=typeof wpglobus_wpseo?wpglobus_wpseo():"undefined"!=typeof WPGlobusYoastSeo&&("undefined"!=typeof WPGlobusYoastSeoPremium&&WPGlobusYoastSeoPremium&&WPGlobusYoastSeoPremium.init(),WPGlobusYoastSeo.init())),WPGlobusAdmin.data.modify_excerpt){var n=c("#excerpt");n.addClass("hidden").css({display:"none"}),c(WPGlobusAdmin.data.template).insertAfter(n),c("body").on("change",".wpglobus-excerpt",function(){var t=c(this);n.val(WPGlobusCore.getString(n.val(),t.val(),t.data("language")))})}if(void 0!==wp.utils&&void 0!==wp.utils.WordCounter){WPGlobusCoreData.wordCounter={};var l=this,s={};c.each(WPGlobusCoreData.enabled_languages,function(t,a){if(a==WPGlobusCoreData.default_language)return!0;var n,e,i;s[t]="content_"+a,n=jQuery,e=new wp.utils.WordCounter,i=a,WPGlobusCoreData.wordCounter[i]={},WPGlobusCoreData.wordCounter[i].counter=e,n(function(){function o(t){var a,e;"object"==typeof t&&(t="tinymce"==t?l.getCurrentTab():t.target.id.replace("content_","")),void 0!==WPGlobusCoreData.wordCounter[t]&&(a=!WPGlobusCoreData.wordCounter[t].contentEditor||WPGlobusCoreData.wordCounter[t].contentEditor.isHidden()?WPGlobusCoreData.wordCounter[t].content.val():WPGlobusCoreData.wordCounter[t].contentEditor.getContent({format:"raw"}),(e=WPGlobusCoreData.wordCounter[t].counter.count(a))!==WPGlobusCoreData.wordCounter[t].prevCount&&WPGlobusCoreData.wordCounter[t].count.text(e),WPGlobusCoreData.wordCounter[t].prevCount=e)}WPGlobusCoreData.wordCounter[i].content=n("#content_"+i),WPGlobusCoreData.wordCounter[i].count=n("#wp-word-count-"+i).find(".word-count-"+i),WPGlobusCoreData.wordCounter[i].prevCount=0,n(document).on("tinymce-editor-init",function(t,a){if(-1!=n.inArray(a.id,s)){var e=a.id.replace("content_","");(WPGlobusCoreData.wordCounter[e].contentEditor=a).on("nodechange keyup",_.debounce(o,1e3))}}),WPGlobusCoreData.wordCounter[i].content.on("input keyup",_.debounce(o,1e3)),o(i)})})}c(document).on("click","#publish, #save-post",function(){if(1<WPGlobusAdmin.data.open_languages.length){c(document).triggerHandler("wpglobus_before_save_post",{content_tabs_id:a});var t,e=c("#title").val(),o="",n="";0==e.length&&(t=WPGlobusAdmin.data.open_languages.indexOf(WPGlobusAdmin.data.default_language),WPGlobusAdmin.data.open_languages.splice(t,1),c(WPGlobusAdmin.data.open_languages).each(function(t,a){n=0==t?"":"-",0<(e=c("#title_"+a).val()).length&&(0==o.length&&(n=""),o=o+n+e)})),0<o.length&&c("#title").val(o)}void 0===WPGlobusAdmin.data.tagsdiv||WPGlobusAdmin.data.tagsdiv.length<1||c(WPGlobusAdmin.data.tagsdiv).each(function(t,a){if(0==c("#"+a).length)return!0;var e=a.replace("tagsdiv-","");if("undefined"===e)return!0;if(0==c("#tax-input-"+e).length)return!0;var o,n=[];c("#tagsdiv-"+e+" .tagchecklist > span").each(function(t,a){o=(o=c(a).html()).replace(/<button.*<\/button>&nbsp;/,""),void 0===WPGlobusAdmin.data.tag[e][o]?n[t]=o:n[t]=WPGlobusAdmin.data.tag[e][o]}),c("#tax-input-"+e).val(n.join(", "))})}),c(".ui-state-default").on("click",function(){"link-tab-default"===c(this).attr("id")&&(c(window).scrollTop(c(window).scrollTop()+1),c(window).scrollTop(c(window).scrollTop()-1))}),c(document).on("tabsactivate",a,function(t,a){WPGlobusAdmin.currentTab=a.newTab[0].dataset.language}),c(document).triggerHandler("wpglobus_after_post_edit")},adminCentral:function(){c(".wpglobus-admin-central-tab").css({display:"none"}),1<c(".nav-tab-active").length&&c(".wpglobus-about-wrap .nav-tab-wrapper a").removeClass("nav-tab-active");var e=!0;0==location.hash.indexOf("#")&&c(".wpglobus-about-wrap .nav-tab-wrapper a").each(function(t,a){c(a).attr("href")==location.hash&&(e=!1,c(a).addClass("nav-tab-active"))}),e&&c(".wpglobus-about-wrap .nav-tab-wrapper a").eq(0).addClass("nav-tab-active");var t=c(".wpglobus-about-wrap .nav-tab-active").data("tab-id");""!=t&&c("#"+t).css({display:"block"}),c(document).on("click",".wpglobus-about-wrap .nav-tab",function(t){var a=c(this);a.hasClass("nav-tab-active")||(c(".wpglobus-admin-central-tab").css({display:"none"}),c(".wpglobus-about-wrap .nav-tab").removeClass("nav-tab-active"),a.addClass("nav-tab-active"),""!=a.data("tab-id")&&c("#"+a.data("tab-id")).css({display:"block"}))})},start:function(){var a=this;c("#wpglobus_flags").select2({formatResult:this.format,formatSelection:this.format,minimumResultsForSearch:-1,escapeMarkup:function(t){return t}}),c("body").on("click","#enabled_languages-list li:first input",function(t){return t.preventDefault(),c(".redux-save-warn").css({display:"none"}),c("#enabled_languages-list").find("li:first > input").val("1"),0===c("#disable_first_language").length&&c(a.config.disable_first_language).insertAfter("#info_bar"),!1})},format:function(t){return'<img class="wpglobus_flag" src="'+WPGlobusAdmin.flag_url+t.text+'"/>&nbsp;&nbsp;'+t.text},set_dialog:function(){if(void 0===WPGlobusAdmin.data.customFieldsEnabled||(WPGlobusAdmin.data.customFieldsEnabled=this.parseBool(WPGlobusAdmin.data.customFieldsEnabled),WPGlobusAdmin.data.customFieldsEnabled)){var o,a=!1,n=function(t){var s,d,u,r="wpglobus_dialog_start wpglobus_dialog_icon";u=['<div class="wpglobus_dialog_options_wrapper hidden">','<input style="width:initial;" id="wpglobus-cb-{{id}}" data-object="#wpglobus-dialog-start-{{id}}" data-meta-key="{{meta-key}}" class="wpglobus_dialog_option wpglobus_dialog_cb" type="checkbox" {{checked}} />',"</div>"].join(""),c(void 0===t?"#the-list tr":"#the-list tr#"+t).each(function(){var t,a,e,o=c(this),n=o.attr("id"),i=o.find("textarea"),l=r;if(void 0===(s=i.attr("id")))return!0;e=c("#"+n+"-key").val(),t=c("#"+s).clone(),c(i).addClass("wpglobus-dialog-field-source hidden"),a=i.attr("name"),c(t).attr("id","wpglobus-"+s),c(t).attr("name","wpglobus-"+a),c(t).attr("data-source-id",s),c(t).attr("class","wpglobus-dialog-field"),c(t).val(WPGlobusCore.TextFilter(c(i).val(),WPGlobusCoreData.language)),c(t).insertAfter(i),d=(d=u.replace(/{{id}}/g,s)).replace(/{{meta-key}}/g,e),void 0===WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type]?d=d.replace(/{{checked}}/,"checked"):void 0!==WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][e]&&"false"==WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][e]?(d=d.replace(/{{checked}}/,""),l=r+" wpglobus_dialog_start_hidden"):(d=d.replace(/{{checked}}/,"checked"),l=r),o.append('<td style="width:20px;"><div id="wpglobus-dialog-start-'+s+'" data-type="control" data-source-type="textarea" data-source-id="'+s+'" class="'+l+'"></div>'+d+"</td>")}),!a&&0<c("#list-table .wpglobus_dialog_start").length&&(c("#list-table thead tr").append('<th class="wpglobus-control-head"><div class="wpglobus_dialog_settings wpglobus_dialog_icon"></div></th>'),a=!0)};n(),c("body").on("change",".wpglobus-dialog-field",function(){var e,o,n=c(this),t="#"+n.data("source-id"),i="";void 0!==t&&(e=c(t).val(),/(\{:|\[:|<!--:)[a-z]{2}/.test(e)?(c.each(WPGlobusCoreData.enabled_languages,function(t,a){""!=(o=a==WPGlobusCoreData.language?n.val():WPGlobusCore.TextFilter(e,a,"RETURN_EMPTY"))&&(i+=WPGlobusCore.addLocaleMarks(o,a))}),c(t).val(i)):c(t).val(n.val()))}),c(document).ajaxSend(function(t,a,e){"add-meta"==e.action&&(o=e.element)}),c(document).ajaxComplete(function(t,a,e){"add-meta"==e.action&&void 0!==a.responseXML&&n("newmeta"==o?"meta-"+c(a.responseXML.documentElement.outerHTML).find("meta").attr("id"):o)}),WPGlobusDialogApp.init({dialogTitle:"Edit meta"})}}},new t.App,t)});
includes/js/wpglobus-admin-49.js CHANGED
@@ -1,1654 +1,1654 @@
1
- /**
2
- * WPGlobus Administration Core, Dialog, Admin
3
- * Interface JS functions
4
- *
5
- * @since 1.9.0
6
- *
7
- * @package WPGlobus
8
- * @subpackage Administration
9
- */
10
- /*jslint browser: true*/
11
- /*global jQuery, console, WPGlobusCore, WPGlobusDialogApp, WPGlobusAdmin, inlineEditPost */
12
-
13
- var WPGlobusCore;
14
-
15
- (function($) {
16
- var api;
17
- api = WPGlobusCore = {
18
- strpos: function( haystack, needle, offset){
19
- haystack = "" + haystack;
20
- var i = haystack.indexOf( needle, offset );
21
- return i >= 0 ? i : false;
22
- },
23
-
24
- TextFilter: function(text, language, return_in){
25
- if ( typeof text == 'undefined' || '' === text ) { return text; }
26
-
27
- var pos_start, pos_end, possible_delimiters = [], is_local_text_found = false;;
28
-
29
- language = '' == language ? 'en' : language;
30
- return_in = typeof return_in == 'undefined' || '' == return_in ? 'RETURN_IN_DEFAULT_LANGUAGE' : return_in;
31
-
32
- possible_delimiters[0] = [];
33
- possible_delimiters[0]['start'] = WPGlobusCoreData.locale_tag_start.replace('%s', language);
34
- possible_delimiters[0]['end'] = WPGlobusCoreData.locale_tag_end;
35
-
36
- possible_delimiters[1] = [];
37
- possible_delimiters[1]['start'] = '<!--:'+language+'-->';
38
- possible_delimiters[1]['end'] = '<!--:-->';
39
-
40
- possible_delimiters[2] = [];
41
- possible_delimiters[2]['start'] = '[:'+language+']';
42
- possible_delimiters[2]['end'] = '[:';
43
-
44
-
45
-
46
- for (var i = 0; i < 3; i++) {
47
-
48
- pos_start = api.strpos( text, possible_delimiters[i]['start'] );
49
- if ( pos_start === false ) {
50
- continue;
51
- }
52
-
53
- pos_start = pos_start + possible_delimiters[i]['start'].length;
54
-
55
- pos_end = api.strpos( text, possible_delimiters[i]['end'], pos_start );
56
-
57
- if ( pos_end === false ) {
58
- text = text.substr( pos_start );
59
- } else {
60
- text = text.substr( pos_start, pos_end - pos_start );
61
- }
62
-
63
- is_local_text_found = true;
64
- break;
65
-
66
- }
67
-
68
- if ( ! is_local_text_found ) {
69
- if ( return_in == 'RETURN_EMPTY' ) {
70
- if ( language == WPGlobusCoreData.default_language && ! /(\{:|\[:|<!--:)[a-z]{2}/.test(text) ) {
71
- /** do nothing */
72
- } else {
73
- text = '';
74
- }
75
- } else {
76
- /**
77
- * Try RETURN_IN_DEFAULT_LANGUAGE.
78
- */
79
- if ( language == WPGlobusCoreData.default_language ) {
80
- if ( /(\{:|\[:|<!--:)[a-z]{2}/.test(text) ) {
81
- text = '';
82
- }
83
- } else {
84
- text = api.TextFilter( text, WPGlobusCoreData.default_language );
85
- }
86
- }
87
- }
88
- return text;
89
- },
90
- addLocaleMarks: function(text, language) {
91
- return WPGlobusCoreData.locale_tag_start.replace('%s', language) + text + WPGlobusCoreData.locale_tag_end;
92
- },
93
- getTranslations: function(text) {
94
- var t = {},
95
- return_in;
96
- $.each(WPGlobusCoreData.enabled_languages, function(i,l){
97
- return_in = l == WPGlobusCoreData.default_language ? 'RETURN_IN_DEFAULT_LANGUAGE' : 'RETURN_EMPTY';
98
- t[l] = api.TextFilter(text, l, return_in);
99
- });
100
- return t;
101
- },
102
- getString: function(s, newVal, l) {
103
- if ( 'undefined' === typeof(s) ) {
104
- return s;
105
- }
106
- if ( 'undefined' === typeof(newVal) ) {
107
- newVal = '';
108
- }
109
- if ( 'undefined' === typeof(l) ) {
110
- l = WPGlobusCoreData.language;
111
- }
112
-
113
- s = api.getTranslations(s);
114
- s[l] = newVal;
115
-
116
- var cS = '';
117
-
118
- $.each(s, function(ln,val){
119
- if ( '' != val && ln != WPGlobusCoreData.default_language) {
120
- cS += api.addLocaleMarks(val, ln);
121
- }
122
- });
123
-
124
- if ( '' != s[WPGlobusCoreData.default_language] ) {
125
- if ( '' == cS ) {
126
- cS = s[WPGlobusCoreData.default_language];
127
- } else {
128
- cS = api.addLocaleMarks(s[WPGlobusCoreData.default_language], WPGlobusCoreData.default_language) + cS;
129
- }
130
- }
131
- return cS;
132
- }
133
- };
134
- })(jQuery);
135
-
136
- var WPGlobusDialogApp;
137
-
138
- (function($) {
139
-
140
- var api;
141
- api = WPGlobusDialogApp = {
142
- option : {
143
- listenClass : '.wpglobus_dialog_start',
144
- settingsClass : '.wpglobus_dialog_settings',
145
- dialogTabs: '#wpglobus-dialog-tabs',
146
- dialogTitle: '',
147
- customData: null,
148
- callback: function(){},
149
- dialogOptions: {
150
- title: '',
151
- placeholder: '',
152
- formFooter: '',
153
- beforeOpen: function(){},
154
- close: function(){},
155
- },
156
- dialog: {}
157
- },
158
- form : undefined,
159
- element : undefined,
160
- element_by : 'id',
161
- id : '',
162
- clone_id: '',
163
- wpglobus_id : '',
164
- type : 'textarea',
165
- source : '',
166
- order : {},
167
- value : {},
168
- request : 'core',
169
- attrs: {},
170
- dialogTitle: '',
171
- trClass: 'wpglobus-translatable',
172
- startButton: [
173
- '<span id="wpglobus-dialog-start-{{clone_id}}" ',
174
- 'style="{{style}}" ',
175
- 'data-type="control" data-dialog-title="{{title}}" ',
176
- 'data-source-type="" data-source-id="{{id}}" data-source-name="{{name}}" ',
177
- 'data-nodename="{{nodename}}"',
178
- '{{sbTitle}} ',
179
- 'class="{{classes}}"></span>'
180
- ].join(''),
181
- startButtonClass : 'wpglobus_dialog_start wpglobus_dialog_icon',
182
- clicks: 0,
183
- init: function(args) {
184
- api.option.dialog = api.option.dialogOptions;
185
- api.option = $.extend(api.option, args);
186
- $(api.option.dialogTabs).tabs();
187
- api.dialogTitle = api.option.dialogTitle;
188
- this.attachListener();
189
- if ( api.option.customData != null && typeof api.option.customData.addElements != 'undefined' ) {
190
- $.each(api.option.customData.addElements, function(i,e) {
191
- api.addElement(e);
192
- });
193
- }
194
- },
195
- convertToId: function(s){
196
- s = s.replace(/\]/g,'');
197
- s = s.replace(/\[/g,'-');
198
- return s;
199
- },
200
- addElement: function(elem) {
201
- var option = {
202
- id: null,
203
- style: '',
204
- styleTextareaWrapper: '',
205
- sbTitle: '',
206
- onChangeClass: '',
207
- dialogTitle: '',
208
- dialog: api.option.dialogOptions
209
- }
210
- if ( 'string' == typeof(elem) ) {
211
- option.id = elem;
212
- } else if ( 'object' == typeof(elem) ) {
213
- option = $.extend(option, elem);
214
- } else {
215
- return;
216
- }
217
-
218
- var $element = null, id = null, name = null, node = null,
219
- sb = api.startButton,
220
- clone, v, style, nodeName = '';
221
-
222
- api.element_by = 'name';
223
- node = document.getElementsByName(option.id);
224
-
225
- if ( 0 == node.length ) {
226
- api.element_by = 'id';
227
- node = document.getElementById(option.id);
228
- }
229
-
230
- if ( null === node ) {
231
- return;
232
- } else {
233
- id = option.id;
234
- if ( 'id' == api.element_by ) {
235
- $element = $('#'+id);
236
- } else {
237
- nodeName = node[0].nodeName;
238
- nodeName = nodeName.toLowerCase();
239
- $element = $(nodeName+'[name="'+id+'"]');
240
- }
241
- }
242
-
243
- if ( 'undefined' === typeof $element.attr('name') || '' == $element.attr('name') ) {
244
- name = id;
245
- } else {
246
- name = $element.attr('name');
247
- }
248
- api.clone_id = api.convertToId(id);
249
-
250
- if ( -1 != name.indexOf( 'wpglobus' ) || -1 != api.clone_id.indexOf( 'wpglobus' ) ) {
251
- /**
252
- * To prevent add element to itself.
253
- */
254
- return false;
255
- }
256
-
257
- if ( $( '#wpglobus-'+api.clone_id ).length > 0 ) {
258
- /**
259
- * WPGlobus element exists already.
260
- */
261
- return false;
262
- }
263
- if ( $( nodeName+'[name="wpglobus-'+name+'"]' ).length > 0 ) {
264
- /**
265
- * WPGlobus element exists already.
266
- */
267
- return false;
268
- }
269
-
270
- clone = $( $element.clone() );
271
- //$element.addClass('hidden');
272
- style = $element.attr('style') || '';
273
- $element.attr( 'style', 'display:none;' );
274
- clone.attr( 'id', 'wpglobus-'+api.clone_id ).attr( 'name', 'wpglobus-'+name );
275
-
276
- /**
277
- * Add WPGlobus translatable class.
278
- */
279
- clone.addClass( api.trClass );
280
-
281
- if ( option.onChangeClass != '' ) {
282
- /**
283
- * add class to bind 'change' event
284
- */
285
- clone.addClass( option.onChangeClass );
286
- }
287
-
288
- if ( 'id' == api.element_by ) {
289
- clone.attr('data-source-id', id).attr('data-source-name', '').attr('data-source-get-by',api.element_by);
290
- } else {
291
- clone.attr('data-source-id', '').attr('data-source-name', name).attr('data-source-get-by',api.element_by);
292
- }
293
-
294
- if ( 'textarea' == nodeName ) {
295
- v = WPGlobusCore.getTranslations( $element.val() )[WPGlobusCoreData['language']];
296
- clone.val( v );
297
- clone.attr( 'data-nodename', 'textarea' );
298
- if ( '' == option.style ) {
299
- clone.attr( 'style', style + ';width:95%;float:left;' );
300
- } else {
301
- clone.attr( 'style', style + ';' + option.style );
302
- }
303
- } else {
304
- v = WPGlobusCore.getTranslations( $element.val() )[WPGlobusCoreData['language']];
305
- clone.attr( 'value', v );
306
- clone.attr( 'data-nodename', 'input' );
307
- if ( '' != option.style ) {
308
- clone.attr( 'style', style + ';' + option.style );
309
- }
310
- }
311
-
312
- /**
313
- * Add dialog options.
314
- * @since 1.7.12
315
- */
316
- if ( '' != option.dialog ) {
317
- clone.attr( 'data-dialog', JSON.stringify(option.dialog) );
318
- }
319
-
320
- sb = sb.replace(/{{clone_id}}/g, api.clone_id);
321
- if ( 'id' == api.element_by ) {
322
- sb = sb.replace(/{{id}}/g, api.clone_id);
323
- sb = sb.replace(/{{name}}/g, '');
324
- sb = sb.replace(/{{nodename}}/g, '');
325
- } else {
326
- sb = sb.replace(/{{id}}/g, '');
327
- sb = sb.replace(/{{name}}/g, name);
328
- sb = sb.replace(/{{nodename}}/g, nodeName);
329
- }
330
- sb = 'textarea' == nodeName ? sb.replace( '{{style}}', 'float:left;margin-top:0;' ) : sb.replace( '{{style}}', '' );
331
- var startButtonClasses = 'textarea' == nodeName ? api.startButtonClass + ' wpglobus-textarea wpglobus-textarea-'+api.clone_id : api.startButtonClass;
332
- sb = sb.replace( '{{classes}}', startButtonClasses );
333
- sb = option.dialogTitle == '' ? sb.replace('{{title}}', api.dialogTitle) : sb.replace('{{title}}', option.dialogTitle);
334
- sb = option.sbTitle == '' ? sb.replace('{{sbTitle}}', option.sbTitle) : sb.replace('{{sbTitle}}', 'title="'+option.sbTitle+'"');
335
-
336
- $(sb).insertAfter($element);
337
- $(clone).insertAfter($element);
338
-
339
- if ( 'textarea' == nodeName ) {
340
- $('#wpglobus-'+api.clone_id).addClass( 'wpglobus-textarea-'+api.clone_id );
341
- $('.wpglobus-textarea-'+api.clone_id).wrapAll( '<div class="wpglobus-textarea-wrapper" style="'+option.styleTextareaWrapper+'"></div>' );
342
- }
343
-
344
- /**
345
- * Bind change event
346
- */
347
- var selector, ret = false;
348
- if ( option.onChangeClass == '' ) {
349
- selector = '#wpglobus-' + api.clone_id;
350
- } else {
351
- selector = '.' + option.onChangeClass;
352
- var $events = $._data( $(document)[0], 'events' );
353
- if( typeof $events === 'undefined' ){
354
- ret = true;
355
- } else {
356
- if ( typeof $events.change !== 'undefined' ) {
357
- $.each( $events.change, function(i, ev){
358
- if ( ev.selector == selector ) {
359
- ret = true;
360
- return false;
361
- }
362
- });
363
- }
364
- }
365
- }
366
-
367
- if ( ret ) {
368
- /**
369
- * Return because we had bound 'change' event already.
370
- */
371
- return true;
372
- }
373
-
374
- $(document).on( 'change', selector, function() {
375
- var $t = $(this),
376
- sid = $t.data( 'source-id' );
377
-
378
- if ( '' == sid ) {
379
- sid = $t.data( 'nodename' ) + '[name="' + $t.data( 'source-name' ) + '"]';
380
- } else {
381
- sid = '#' + sid;
382
- }
383
- $(sid).val( WPGlobusCore.getString( $(sid).val(), $t.val() ) );
384
- });
385
- return true;
386
- },
387
- saveDialog: function() {
388
- var s = '', sdl = '', scl = '', $e, val, l;
389
- $('.wpglobus_dialog_textarea').each(function(indx,e){
390
- $e = $(e);
391
- val = $e.val();
392
- l = $e.data('language');
393
- if ( l == WPGlobusAdmin.data.language ) {
394
- scl = val;
395
- }
396
- if ( val != '' ) {
397
- s = s + WPGlobusCore.addLocaleMarks(val,l);
398
- if ( l == WPGlobusCoreData.default_language ) {
399
- sdl = val;
400
- }
401
- }
402
- });
403
- s = s.length == sdl.length + 8 ? sdl : s;
404
- $(api.id).val(s);
405
- s = scl == '' ? sdl : scl;
406
- $(api.wpglobus_id).val(s);
407
- },
408
- dialog : $('#wpglobus-dialog-wrapper').dialog({
409
- autoOpen: false,
410
- //height: 250,
411
- width: 650,
412
- modal: true,
413
- dialogClass: 'wpglobus-dialog',
414
- buttons: [
415
- {
416
- text:'Save',
417
- class: 'wpglobus-button-save',
418
- click:function(){api.saveDialog(); api.dialog.dialog('close');}
419
- },
420
- {
421
- text:'Cancel',
422
- class: 'wpglobus-button-cancel',
423
- click: function(){api.dialog.dialog('close');}
424
- }
425
- ],
426
- open: function( event, ui ) {
427
- var title = api.dialogTitle;
428
- if ( typeof api.attrs.maxlength !== 'undefined' ) {
429
- $('.wpglobus_dialog_textarea').attr('maxlength', api.attrs.maxlength);
430
- title += ' | maxlength='+api.attrs.maxlength;
431
- }
432
- $('.wpglobus-dialog .ui-dialog-title').text(title);
433
- },
434
- close: function() {
435
- /**
436
- * Close callback.
437
- */
438
- api.runCallback( api.option.dialog.close );
439
-
440
- api.form[0].reset();
441
- //allFields.removeClass( "ui-state-error" );
442
- }
443
- }),
444
- attachListener : function() {
445
- $(document).on('click', api.option.settingsClass, function() {
446
- if ( $('.wpglobus_dialog_options_wrapper').hasClass('hidden') ) {
447
- $('.wpglobus_dialog_options_wrapper').removeClass('hidden');
448
- } else {
449
- $('.wpglobus_dialog_options_wrapper').addClass('hidden');
450
- }
451
- });
452
- $(document).on('click', '.wpglobus_dialog_option', function(event) {
453
- var $t = $(this), r;
454
- var ob = $t.data('object');
455
- api.order['action'] = 'save_post_meta_settings';
456
- api.order['post_type'] = WPGlobusAdmin.data.post_type;
457
- api.order['checked'] = $t.prop('checked');
458
- api.order['id'] = $t.attr('id');
459
- api.order['meta_key'] = $t.data('meta-key');
460
- r = api.ajax(api.order);
461
- r.done(function (result) {
462
- if ( result.result == 'ok' ) {
463
- if ( result.checked == 'true' ) {
464
- $(ob).removeClass('wpglobus_dialog_start_hidden');
465
- } else {
466
- $(ob).addClass('wpglobus_dialog_start_hidden');
467
- }
468
- }
469
- })
470
- .fail(function (error) {})
471
- .always(function (jqXHR, status){});
472
- });
473
- $(document).on('click', api.option.listenClass, function(e) {
474
- api.element = $(this);
475
- api.id = api.element.data('source-id');
476
- if ( '' == api.id ) {
477
- api.id = api.element.data('nodename') + '[name="'+api.element.data('source-name')+'"]';
478
- api.wpglobus_id = '#wpglobus-'+api.convertToId( api.element.data('source-name') );
479
- } else {
480
- api.wpglobus_id = '#wpglobus-'+api.id;
481
- api.id = '#'+api.id;
482
- }
483
-
484
- api.clicks++;
485
- if ( api.clicks == 1 ) {
486
- setTimeout(function () {
487
- if (api.clicks == 1) {
488
- api.onClick(e);
489
- } else {
490
- var s = $(api.id);
491
- if ( s.hasClass('hidden') ) {
492
- s.removeClass('hidden').attr('style', 'display:block;');
493
- } else {
494
- s.addClass('hidden').attr('style', 'display:none;');
495
- }
496
- }
497
- api.clicks = 0;
498
- }, 200);
499
- }
500
- });
501
- api.form = api.dialog.find('form#wpglobus-dialog-form').on('submit', function( event ) {
502
- event.preventDefault();
503
- api.saveDialog();
504
- });
505
- },
506
- ajax : function(order) {
507
- return $.ajax({type:'POST', url:WPGlobusAdmin.ajaxurl, data:{action:WPGlobusAdmin.process_ajax, order:order}, dataType:'json', async:false});
508
- },
509
- onClick: function(ev) {
510
- if ( typeof(api.element.data('dialog-title')) == 'undefined' || '' == api.element.data('dialog-title') ) {
511
- api.dialogTitle = api.option.dialogTitle;
512
- } else {
513
- api.dialogTitle = api.element.data('dialog-title');
514
- }
515
- if ( typeof api.id !== 'undefined' ) {
516
- api.attrs['maxlength'] = $(api.id).attr('maxlength');
517
- }
518
-
519
- api.source = api.element.data('source-value');
520
- if ( typeof api.source === 'undefined' ) {
521
- api.source = $(api.id).val();
522
- if (api.request == 'ajax') {
523
- // @todo revise ajax action
524
- //api.order['action'] = 'get_translate';
525
- //api.order['source'] = api.source;
526
- //api.ajax(api.order);
527
- } else {
528
- api.value = WPGlobusCore.getTranslations(api.source);
529
- }
530
- }
531
-
532
- /**
533
- * Get dialog form options.
534
- */
535
- api.option.dialog = $.extend( {}, api.option.dialogOptions, $(api.wpglobus_id).data('dialog') );
536
-
537
- if ( '' != api.option.dialog.title ) {
538
- api.dialogTitle = api.option.dialog.title;
539
- }
540
-
541
- $.each(api.value, function(l,e){
542
- var $d = $('#wpglobus-dialog-'+l);
543
- /**
544
- * Value.
545
- */
546
- $d.val(e);
547
-
548
- /**
549
- * Placeholder.
550
- */
551
- $d.attr(
552
- 'placeholder',
553
- WPGlobusCore.TextFilter( api.option.dialog.placeholder, l, 'RETURN_IN_DEFAULT_LANGUAGE' )
554
- );
555
- });
556
-
557
- /**
558
- * Dialog form footer.
559
- */
560
- $('#wpglobus-dialog-form-footer').html(api.option.dialog.formFooter);
561
-
562
- /**
563
- * Before open callback.
564
- */
565
- api.runCallback( api.option.dialog.beforeOpen );
566
-
567
- api.dialog.dialog('open');
568
- },
569
- runCallback: function(callback) {
570
-
571
- if ( 'object' === typeof callback ) {
572
- var k = Object.keys(callback)[0];
573
- var fn = callback[Object.keys(callback)[0]]
574
- if ( 'window' === k ) {
575
- if ( 'function' === typeof window[fn] ) {
576
- window[fn]( callback[Object.keys(callback)[1]] );
577
- }
578
- } else if ( 'function' === typeof window[k][fn] ) {
579
- window[k][fn]( callback[Object.keys(callback)[1]] );
580
- }
581
- } else if ( 'string' === typeof callback ) {
582
- if ( 'function' === typeof window[callback] ) {
583
- window[callback]();
584
- }
585
- }
586
-
587
- }
588
- };
589
-
590
- })(jQuery);
591
-
592
- jQuery(document).ready(function () {
593
- "use strict";
594
- window.WPGlobusAdminApp = (function (WPGlobusAdminApp, $) {
595
- /* Object Constructor
596
- ========================*/
597
- WPGlobusAdminApp.App = function (config) {
598
-
599
- if ( 'undefined' !== typeof window.WPGlobusAdminApp ) {
600
- return;
601
- }
602
-
603
- this.config = {
604
- debug: false,
605
- version: WPGlobusAdmin.version
606
- };
607
-
608
- this.status = 'ok';
609
-
610
- if ( 'undefined' === typeof WPGlobusAdmin ) {
611
- this.status = 'error';
612
- if (this.config.debug) {
613
- console.log('WPGlobus: error options loading');
614
- }
615
- } else {
616
- if (this.config.debug) {
617
- console.dir(WPGlobusAdmin);
618
- }
619
- }
620
-
621
- this.config.disable_first_language = [
622
- '<div id="disable_first_language" style="display:block;" class="redux-field-errors notice-red">',
623
- '<strong>',
624
- '<span>&nbsp;</span>',
625
- WPGlobusAdmin.i18n.cannot_disable_language,
626
- '</strong>',
627
- '</div>'
628
- ].join('');
629
-
630
- $.extend(this.config, config);
631
-
632
- if ('ok' === this.status) {
633
- this.init();
634
- }
635
- };
636
-
637
- WPGlobusAdminApp.App.prototype = {
638
- $document : $(document),
639
- init: function () {
640
- WPGlobusCoreData.multisite = this.parseBool(WPGlobusCoreData.multisite);
641
- this.adminInit();
642
- $('#content').addClass('wpglobus-editor').attr('data-language',WPGlobusAdmin.data.default_language);
643
- $('textarea[id^=content_]').each(function(i,e){
644
- var l=$(e).attr('id').replace('content_','');
645
- $(e).attr('data-language',l);
646
- });
647
- if ('post.php' === WPGlobusAdmin.page) {
648
- this.postEdit();
649
- this.set_dialog();
650
- if ( 'undefined' !== typeof WPGlobusAioseop ) {
651
- WPGlobusAioseop.init();
652
- }
653
- } else if ('menu-edit' === WPGlobusAdmin.page) {
654
- this.navMenus();
655
- } else if ('taxonomy-edit' === WPGlobusAdmin.page) {
656
- if (WPGlobusAdmin.data.tag_id) {
657
- this.taxonomyEdit();
658
- }
659
- } else if ('taxonomy-quick-edit' === WPGlobusAdmin.page) {
660
- this.quickEdit('taxonomy');
661
- } else if ('edit.php' === WPGlobusAdmin.page) {
662
- this.quickEdit('post');
663
- } else if ('options-general.php' == WPGlobusAdmin.page) {
664
- this.optionsGeneral();
665
- WPGlobusDialogApp.init({customData:WPGlobusCoreData.page_custom_data});
666
- } else if ('widgets.php' == WPGlobusAdmin.page) {
667
- WPGlobusWidgets.init();
668
- WPGlobusDialogApp.init({dialogTitle:'Edit text'});
669
- } else if ('wpglobus_options' == WPGlobusAdmin.page) {
670
- this.start();
671
- } else if ('wpglobusAdminCentral' == WPGlobusAdmin.page) {
672
- this.adminCentral();
673
- } else {
674
- /**
675
- * Init WPGlobusDialogApp for using in a 3-party plugins.
676
- */
677
- WPGlobusDialogApp.init({customData:WPGlobusCoreData.page_custom_data});
678
- }
679
- },
680
- parseBool: function(b) {
681
- return !(/^(false|0)$/i).test(b) && !!b;
682
- },
683
- getCurrentTab: function() {
684
- return $( '.wpglobus-post-body-tabs-list .ui-tabs-active' ).data( 'language' );
685
- },
686
- adminInit: function () {
687
- var order = $('.wpglobus-addons-group a').data('key');
688
- if ( 'undefined' !== typeof order ) {
689
- if ( window.location.search.indexOf('page=wpglobus_options&tab='+order) >= 0 ) {
690
- if ( WPGlobusCoreData.multisite ) {
691
- window.location = WPGlobusCoreData.pluginInstallLocation.multisite;
692
- } else {
693
- window.location = WPGlobusCoreData.pluginInstallLocation.single;
694
- }
695
- } else {
696
- var addon = $('#toplevel_page_wpglobus_options li').eq(order+1);
697
- if ( WPGlobusCoreData.multisite ) {
698
- $(addon).find('a').attr('href',WPGlobusCoreData.pluginInstallLocation.multisite).attr('onclick',"window.location=jQuery(this).attr('href');return false;");
699
- } else {
700
- $(addon).find('a').attr('href',WPGlobusCoreData.pluginInstallLocation.single).attr('onclick',"window.location=jQuery(this).attr('href');return false;");
701
- }
702
- }
703
- }
704
- },
705
- optionsGeneral: function() {
706
- var $bn = $('#blogname'),
707
- $body = $('body');
708
-
709
- $bn.addClass('hidden');
710
- $('#wpglobus-blogname').insertAfter($bn).removeClass('hidden');
711
-
712
- $body.on('blur', '.wpglobus-blogname', function () {
713
- $('.wpglobus-blogname').each( function (i, e) {
714
- var $e = $(e);
715
- $bn.val( WPGlobusCore.getString( $bn.val(), $e.val(), $e.data('language') ) );
716
- });
717
- });
718
-
719
- var $bd = $('#blogdescription');
720
- $bd.addClass('hidden');
721
- $('#wpglobus-blogdescription').insertAfter($bd).removeClass('hidden');
722
- $body.on('blur', '.wpglobus-blogdesc', function () {
723
- $('.wpglobus-blogdesc').each( function (i, e) {
724
- var $e = $(e);
725
- $bd.val( WPGlobusCore.getString( $bd.val(), $e.val(), $e.data('language') ) );
726
- });
727
- });
728
- },
729
- quickEdit: function(type) {
730
- /**
731
- * For more info @see ajax handler 'wp_ajax_inline_save'.
732
- */
733
- if ( 'undefined' === typeof WPGlobusAdmin.data.has_items ) {
734
- return;
735
- }
736
- if (!WPGlobusAdmin.data.has_items) {
737
- return;
738
- }
739
- var full_id = '', id = 0;
740
-
741
- $(document).ajaxComplete(function(event, jqxhr, settings){
742
- if (typeof settings.data === 'undefined') {
743
- return;
744
- }
745
- if ( full_id == '' ) {
746
- return;
747
- }
748
- if (settings.data.indexOf('action=inline-save-tax&') >= 0) {
749
- $('#'+full_id+' a.row-title').text(WPGlobusAdmin.qedit_titles[id][WPGlobusAdmin.data.language]['name']);
750
- $('#'+full_id+' .description').text(WPGlobusAdmin.qedit_titles[id][WPGlobusAdmin.data.language]['description']);
751
- }
752
- });
753
-
754
- var title = {};
755
- $('#the-list tr').each(function (i, e) {
756
- var $e = $(e);
757
- var k = ( type === 'post' ? 'post-' : 'tag-' );
758
- id = $e.attr('id').replace(k, ''); /* don't need var with id, see line 109 */
759
- title[id] = {};
760
- if ('post' === type) {
761
- title[id]['source'] = $e.find('.post_title').text();
762
- } else if ('taxonomy' === type) {
763
- title[id]['source'] = $('#inline_' + id + ' .name').text();
764
- }
765
- });
766
-
767
- var order = {};
768
- order['action'] = 'get_titles';
769
- order['type'] = type;
770
- order['taxonomy'] = typeof WPGlobusAdmin.data.taxonomy === 'undefined' ? false : WPGlobusAdmin.data.taxonomy;
771
- order['title'] = title;
772
- $.ajax({type:'POST', url:WPGlobusAdmin.ajaxurl, data:{action:WPGlobusAdmin.process_ajax, order:order}, dataType:'json'})
773
- .done(function (result) {
774
- WPGlobusAdmin.qedit_titles = result.qedit_titles;
775
- $.each(result.bulkedit_post_titles, function(id, obj){
776
- $('#inline_'+id+' .post_title').text(obj[WPGlobusAdmin.data.language]['name']);
777
- });
778
- })
779
- .fail(function (error) {
780
- })
781
- .always(function (jqXHR, status) {
782
- });
783
-
784
- $('body').on('change', '.wpglobus-quick-edit-title', function () {
785
- var s = '';
786
- var lang = [];
787
- $('.wpglobus-quick-edit-title').each(function (index, e) {
788
- var $e = $(e);
789
- var l = $e.data('language');
790
- if ($e.val() !== '') {
791
- s = WPGlobusCore.getString( s, $e.val(), l );
792
- }
793
- WPGlobusAdmin.qedit_titles[ id ][ l ][ 'name' ] = $e.val();
794
- lang[ index ] = l;
795
- });
796
-
797
- var so = $(document).triggerHandler( 'wpglobus_get_translations', {string:s, lang:lang, id:id} );
798
- if ( typeof so !== 'undefined' ) {
799
- s = so;
800
- }
801
- $( 'input.ptitle' ).eq( 0 ).attr( 'value', s ) ;
802
- WPGlobusAdmin.qedit_titles[ id ][ 'source' ] = s;
803
- });
804
-
805
- if ( typeof WPGlobusAdmin.data.tags !== 'undefined' ) {
806
- $.each( WPGlobusAdmin.data.tags, function(i,tag){
807
- WPGlobusAdmin.data.value[tag]['post_id'] = {};
808
- });
809
- }
810
-
811
- $('button.save, input#bulk_edit').on('mouseenter', function (event) {
812
- /**
813
- * Quick edit action for the "Tags" box in edit.php page.
814
- */
815
- if ( typeof WPGlobusAdmin.data.tags === 'undefined' ) {
816
- return;
817
- }
818
-
819
- if (event.currentTarget.id=='bulk_edit') {
820
- $('input#bulk_edit').unbind('click');
821
- } else {
822
- $('button.save').unbind('click');
823
- }
824
-
825
- $( 'button.save, input#bulk_edit').on('click', function (event) {
826
- //console.log( 'Start Updating' );
827
- var promise = $.when();
828
-
829
- var tagsHandler = function( $elem ) {
830
- $elem.next('.spinner').css({'visibility':'visible'});
831
- if (event.currentTarget.id != 'bulk_edit') {
832
- $.ajaxSetup({async:false});
833
- }
834
- var p = $elem.parents('tr');
835
- var id = p.attr('id').replace('edit-','');
836
- var t,v,newTags;
837
-
838
- $.each( WPGlobusAdmin.data.tags, function(index,tag){
839
- t = p.find("textarea[name='" + WPGlobusAdmin.data.names[tag] + "']");
840
- if ( t.length == 0 ) {
841
- return true;
842
- }
843
- WPGlobusAdmin.data.value[tag]['post_id'][id] = t.val();
844
- v = WPGlobusAdmin.data.value[tag]['post_id'][id].split(',');
845
- newTags = [];
846
- for(var i=0; i<v.length; i++) {
847
- v[i] = v[i].trim(' ');
848
- if ( v[i] != '' ) {
849
- if ( typeof WPGlobusAdmin.data.tag[tag][v[i]] === 'undefined' ) {
850
- newTags[i] = v[i];
851
- } else {
852
- newTags[i] = WPGlobusAdmin.data.tag[tag][v[i]];
853
- }
854
- }
855
- }
856
- t.val( newTags.join(', ') );
857
- });
858
- }
859
-
860
- var $this = $(this);
861
- var start = $.Deferred();
862
- start.resolve( tagsHandler( $(this) ) );
863
-
864
- promise = promise.then(function() {
865
- return $.when(
866
- start.done()
867
- )
868
- }).then( function() {
869
- if (event.currentTarget.id != 'bulk_edit') {
870
- setTimeout(
871
- function() {
872
- inlineEditPost.save(id);
873
- $.ajaxSetup({async:true});
874
- },
875
- 50
876
- );
877
- }
878
- });
879
-
880
- });
881
- });
882
-
883
- $( '#the-list' ).on( 'click', 'a.editinline', function () {
884
- var t = $(this);
885
- full_id = t.parents('tr').attr('id');
886
- if ('post' === type) {
887
- id = full_id.replace('post-', '');
888
- } else if ('taxonomy' === type) {
889
- id = full_id.replace('tag-', '');
890
- } else {
891
- return;
892
- }
893
-
894
- if ( 'post' === type && 'undefined' !== typeof WPGlobusAdmin.data.tags ) {
895
- /**
896
- * @since 1.6.6
897
- */
898
- $.each( WPGlobusAdmin.data.tags, function(i,tag){
899
- if ( WPGlobusAdmin.data.value[tag] != '' ) {
900
- var val = $('#edit-' + id + ' textarea[name="' + WPGlobusAdmin.data.names[tag] + '"]').val(),
901
- currentTags;
902
- if ( 'undefined' !== typeof val ) {
903
- currentTags = val.split(',');
904
- $.each( currentTags, function(order,currentTag) {
905
- val = val.replace(currentTag, WPGlobusCore.TextFilter(currentTag, WPGlobusCoreData.language));
906
- });
907
- $('#edit-' + id + ' textarea[name="' + WPGlobusAdmin.data.names[tag] + '"]').val(val);
908
- }
909
- }
910
- });
911
- }
912
-
913
- var e = $('#edit-' + id + ' input.ptitle').eq(0);
914
- var p = e.parents('label');
915
- e.val(WPGlobusAdmin.qedit_titles[id].source);
916
- e.addClass('hidden');
917
- $(WPGlobusAdmin.data.template).insertAfter(p);
918
-
919
- if ( typeof WPGlobusAdmin.qedit_titles[id] === 'undefined' ) {
920
- WPGlobusAdmin.qedit_titles[id] = {};
921
- WPGlobusAdmin.qedit_titles[id]['source'] = $('#'+full_id+' .name a.row-title').text();
922
- $(WPGlobusAdmin.data.enabled_languages).each(function(i,l){
923
- WPGlobusAdmin.qedit_titles[id][l] = {};
924
- if ( l == WPGlobusAdmin.data.default_language ) {
925
- WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id]['source'];
926
- } else {
927
- WPGlobusAdmin.qedit_titles[id][l]['name'] = '';
928
- }
929
- WPGlobusAdmin.qedit_titles[id][l]['description'] = '';
930
- });
931
- }
932
-
933
- $( '.wpglobus-quick-edit-title' ).each(function ( i, e ) {
934
- var $e = $(e);
935
- var l = $e.data( 'language' );
936
- $e.attr( 'id', l + id );
937
- if ( typeof WPGlobusAdmin.qedit_titles[id][l] !== 'undefined' ) {
938
- WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id][l]['name'].replace( /\\\'/g, "'" );
939
- WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id][l]['name'].replace( /\\\"/g, '"' );
940
- $e.attr( 'value', WPGlobusAdmin.qedit_titles[id][l]['name'] );
941
- WPGlobusAdmin.qedit_titles[id]['source'] =
942
- WPGlobusCore.getString(
943
- WPGlobusAdmin.qedit_titles[id]['source'],
944
- WPGlobusAdmin.qedit_titles[id][l]['name'],
945
- l
946
- );
947
- }
948
- });
949
- $( 'input.ptitle' ).eq( 0 ).attr( 'value', WPGlobusAdmin.qedit_titles[ id ][ 'source' ] );
950
- });
951
-
952
- },
953
- taxonomyEdit: function () {
954
-
955
- var elements = [];
956
- elements[0] = 'name';
957
- elements[1] = 'description';
958
-
959
- var make_clone = function(id,language){
960
- var $element = $('#'+id),
961
- clone = $element.clone(),
962
- name = $element.attr('name'),
963
- classes = 'wpglobus-element wpglobus-element_'+id+' wpglobus-element_'+language+' wpglobus-translatable',
964
- node;
965
-
966
- node = document.getElementById(id);
967
- node = node.nodeName;
968
- $(clone).attr('id', id+'_'+language);
969
- $(clone).attr('name', name+'_'+language);
970
- if ( language !== WPGlobusCoreData.default_language ) {
971
- classes += ' hidden';
972
- }
973
- $(clone).attr('class', classes);
974
- $(clone).attr('data-save-to', id);
975
- $(clone).attr('data-language', language);
976
- if ( node == 'INPUT' ) {
977
- $(clone).attr('value', $('#wpglobus-link-tab-'+language).data(id));
978
- } else if ( node == 'TEXTAREA' ) {
979
- $(clone).text($('#wpglobus-link-tab-'+language).data(id));
980
- }
981
- $element.addClass('hidden');
982
- if ( $('.wpglobus-element_'+id).length == 0 ) {
983
- $(clone).insertAfter($element);
984
- } else {
985
- $(clone).insertAfter($('.wpglobus-element_'+id).last());
986
- }
987
- };
988
-
989
- $.each(WPGlobusCoreData.enabled_languages, function(i,l){
990
- $.each(elements, function(i,e){
991
- make_clone(e,l);
992
- });
993
- });
994
-
995
- $('.wpglobus-taxonomy-tabs').insertAfter('#ajax-response');
996
-
997
- /**
998
- * Make class wrap as tabs container.
999
- * Tabs on.
1000
- */
1001
- $('.wrap').tabs();
1002
-
1003
- $('body').on('click', '.wpglobus-taxonomy-tabs li', function(event){
1004
- var $t = $(this);
1005
- var language = $t.data('language');
1006
- $('.wpglobus-element').addClass('hidden');
1007
- $('.wpglobus-element_'+language).removeClass('hidden');
1008
- });
1009
-
1010
- $('.wpglobus-element').on('change', function () {
1011
- var $this = $(this),
1012
- save_to = $this.data('save-to'),
1013
- s = '';
1014
-
1015
- $('.wpglobus-element').each(function (index, element) {
1016
- var $e = $(element),
1017
- value = $e.val();
1018
- if ( $e.data('save-to') == save_to && value !== '' ) {
1019
- s = s + WPGlobusCore.addLocaleMarks(value, $e.data('language') )
1020
- }
1021
- });
1022
- $('#' + save_to).val(s);
1023
- });
1024
-
1025
- /**
1026
- * @since 1.8.1
1027
- * $('<span class="wpglobus-multilingual-slug wpglobus_dialog_start wpglobus_dialog_icon" title="Title"></span>').insertBefore('#slug');
1028
- * $('.term-slug-wrap th').css({'padding-right':'0'});
1029
- * $('.term-slug-wrap td').css({'padding-left':'0'});
1030
- */
1031
- $(WPGlobusAdmin.data.multilingualSlug.title).insertAfter('.term-slug-wrap th label');
1032
-
1033
- },
1034
- navMenus: function () {
1035
- var iID, menu_size,
1036
- menu_item = '#menu-to-edit .menu-item';
1037
-
1038
- var timer = function () {
1039
- if ( menu_size !== $(menu_item).length ) {
1040
- clearInterval(iID);
1041
- $(menu_item).each(function (index, li) {
1042
- var $li = $(li);
1043
- if ($li.hasClass('wpglobus-menu-item')) {
1044
- return; /** the same as continue */
1045
- }
1046
- var id = $(li).attr('id');
1047
- $.each(['input.edit-menu-item-title', 'input.edit-menu-item-attr-title'], function (input_index, input) {
1048
- var i = $('#' + id + ' ' + input);
1049
- var $i = $(i);
1050
- if (!$i.hasClass('wpglobus-hidden')) {
1051
- $i.addClass('wpglobus-hidden');
1052
- $i.css('display', 'none');
1053
- var l = $i.parent('label');
1054
- var p = $i.parents('p');
1055
- $(p).css('height', '80px');
1056
- $(l).append('<div style="color:#f00;">' + WPGlobusAdmin.i18n.save_nav_menu + '</div>');
1057
- }
1058
- });
1059
- $li.addClass('wpglobus-menu-item');
1060
- });
1061
- }
1062
- };
1063
-
1064
- $.ajaxSetup({
1065
- beforeSend: function (jqXHR, PlainObject) {
1066
- if (typeof PlainObject.data === 'undefined') {
1067
- return;
1068
- }
1069
- if (PlainObject.data.indexOf('action=add-menu-item') >= 0) {
1070
- menu_size = $(menu_item).length;
1071
- iID = setInterval(timer, 500);
1072
- }
1073
- }
1074
- });
1075
-
1076
- $(menu_item).each(function (index, li) {
1077
-
1078
- var id = $(li).attr('id'),
1079
- item_id = id.replace('menu-item-', '');
1080
-
1081
- $.each(['input.edit-menu-item-title', 'input.edit-menu-item-attr-title'], function (input_index, input) {
1082
- var $i = $('#' + id + ' ' + input);
1083
- if ( $i.val() != WPGlobusAdmin.data.items[ item_id ][ input ][ 'source' ] ) {
1084
- /**
1085
- * fix for case when value resets by WP core
1086
- */
1087
- $i.val( WPGlobusAdmin.data.items[ item_id ][ input ][ 'source' ] );
1088
- }
1089
-
1090
- var p = $( '#' + id + ' ' + input ).parents('p');
1091
- var height = 0;
1092
-
1093
- $.each(WPGlobusAdmin.data.open_languages, function (index, language) {
1094
- var new_element = $i.clone();
1095
- new_element.attr('id', $i.attr('id') + '-' + language);
1096
- new_element.attr('name', $i.attr('id') + '-' + language);
1097
- new_element.attr('data-language', language);
1098
- new_element.attr('data-item-id', item_id);
1099
- new_element.attr('placeholder', WPGlobusAdmin.data.en_language_name[language]);
1100
-
1101
- var classes = WPGlobusAdmin.data.items[item_id][language][input]['class'];
1102
- if (input_index === 0 && language === WPGlobusAdmin.data.default_language) {
1103
- new_element.attr('class', classes + ' edit-menu-item-title');
1104
- } else {
1105
- new_element.attr('class', classes);
1106
- }
1107
-
1108
- if ( WPGlobusAdmin.data.items[ item_id ][ language ][ input ][ 'caption' ] != '' ) {
1109
- new_element.attr('value', WPGlobusAdmin.data.items[item_id][language][input]['caption']);
1110
- } else {
1111
- new_element.attr('value', '');
1112
- }
1113
- new_element.css('margin-bottom', '0.6em');
1114
- $(p).append( new_element );
1115
- height = index;
1116
- });
1117
- height = (height + 1) * 40;
1118
- $i.css('display', 'none').attr('class', '').addClass('widefat wpglobus-hidden');
1119
- $(p).css('height', height + 'px').addClass('wpglobus-menu-item-box');
1120
-
1121
- });
1122
- $(li).addClass('wpglobus-menu-item');
1123
- });
1124
-
1125
- $('.menus-move-left, .menus-move-right').each(function(index,e) {
1126
- var $e = $(e), new_title;
1127
- var item_id = $e.parents('li').attr('id').replace('menu-item-', '');
1128
- var title = $e.attr('title');
1129
- if ( typeof title !== 'undefined' ) {
1130
- $.each(WPGlobusAdmin.data.post_titles, function(post_title, item_title) {
1131
- if ( title.indexOf(post_title) >= 0 ) {
1132
- new_title = title.replace(post_title, item_title);
1133
- $e.attr('title', new_title);
1134
- $e.text(new_title);
1135
- }
1136
- });
1137
- }
1138
- });
1139
-
1140
- /**
1141
- * Run the item handle title when the navigation label was loaded.
1142
- * @see wp-admin\js\nav-menu.js
1143
- */
1144
- $('.edit-menu-item-title').trigger('change');
1145
- wpNavMenu.refreshAdvancedAccessibility();
1146
- wpNavMenu.menusChanged = false;
1147
-
1148
- $('.wpglobus-menu-item').on('change', function () {
1149
- var $this = $(this),
1150
- item_id = $this.data('item-id'),
1151
- s, so;
1152
- if ($this.hasClass('wpglobus-item-title')) {
1153
- s = WPGlobusCore.getString( $('input#edit-menu-item-title-' + item_id).val(), $this.val(), $this.data('language') );
1154
- so = $(document).triggerHandler('wpglobus_get_menu_translations', {string:s, lang:WPGlobusCoreData.open_languages, id:item_id, type:'input.edit-menu-item-title'});
1155
- if ( typeof so !== 'undefined' ) {
1156
- s = so;
1157
- }
1158
- $('input#edit-menu-item-title-' + item_id).val(s);
1159
- }
1160
- if ($this.hasClass('wpglobus-item-attr')) {
1161
- s = WPGlobusCore.getString( $('input#edit-menu-item-attr-title-' + item_id).val(), $this.val(), $this.data('language') );
1162
- so = $(document).triggerHandler('wpglobus_get_menu_translations', {string:s, lang:WPGlobusCoreData.open_languages, id:item_id, type:'input.edit-menu-item-attr-title'});
1163
- if ( typeof so !== 'undefined' ) {
1164
- s = so;
1165
- }
1166
- $('input#edit-menu-item-attr-title-' + item_id).val(s);
1167
- }
1168
-
1169
- });
1170
- },
1171
- postEdit: function () {
1172
- /**
1173
- * Hook into the heartbeat-send.
1174
- */
1175
- $(document).on('heartbeat-send', function(e, data) {
1176
- if ( typeof data['wp_autosave'] !== 'undefined' ) {
1177
- data['wpglobus_heartbeat'] = 'wpglobus';
1178
- $.each(WPGlobusAdmin.data.open_languages, function(i,l){
1179
- var v = $('#title_'+l).val() || '';
1180
- v = $.trim(v);
1181
- if ( v != '' ) {
1182
- data['wp_autosave']['post_title_'+l] = v;
1183
- }
1184
- v = $('#content_'+l).val() || '';
1185
- v = $.trim(v);
1186
- if ( v != '' ) {
1187
- data['wp_autosave']['content_'+l] = v;
1188
- }
1189
- });
1190
- }
1191
- });
1192
-
1193
- var wrap_at = '#postdivrich',
1194
- set_title = true,
1195
- content_tabs_id = '#post-body-content';
1196
- if ( WPGlobusAdmin.data.support['editor'] === false ) {
1197
- wrap_at = '#titlediv';
1198
- set_title = false;
1199
- }
1200
- if ( WPGlobusAdmin.data.support['title'] === false ) {
1201
- set_title = false;
1202
- }
1203
- /**
1204
- * Make post-body-content as tabs container.
1205
- */
1206
- $(content_tabs_id).prepend($('.wpglobus-post-body-tabs-list'));
1207
- $.each(WPGlobusAdmin.tabs, function (index, suffix) {
1208
- if ('default' === suffix) {
1209
- $(wrap_at).wrap('<div id="tab-default"></div>');
1210
- if ( set_title ) {
1211
- $($('#titlediv')).insertBefore(wrap_at);
1212
- }
1213
- } else {
1214
- $(wrap_at+'-' + suffix).wrap('<div id="tab-' + suffix + '"></div>');
1215
- if ( set_title ) {
1216
- $($('#titlediv-' + suffix)).insertBefore(wrap_at+'-' + suffix);
1217
- }
1218
- }
1219
- });
1220
-
1221
- /**
1222
- * Tabs on.
1223
- */
1224
- $(content_tabs_id).addClass('wpglobus-post-body-tabs').tabs({
1225
- beforeActivate: function( event, ui ){
1226
- var otab = ui.oldTab[0].id.replace('link-tab-','');
1227
- var ntab = ui.newTab[0].id.replace('link-tab-','');
1228
- if ( 'default' == otab ) {
1229
- otab = WPGlobusCoreData.default_language;
1230
- }
1231
- if ( 'default' == ntab ) {
1232
- ntab = WPGlobusCoreData.default_language;
1233
- }
1234
- var a = $(document).triggerHandler('wpglobus_post_body_tabs', [ otab, ntab ]);
1235
- if ( a || typeof a === 'undefined' ) {
1236
- return true;
1237
- }
1238
- return false;
1239
- }
1240
- }); /** #post-body-content */
1241
-
1242
- /**
1243
- * Setup for default language.
1244
- */
1245
- $('#title').val(WPGlobusAdmin.title);
1246
-
1247
- /**
1248
- * See other places with the same bookmark.
1249
- * @bookmark EDITOR_LINE_BREAKS
1250
- */
1251
- //$('#content').text(WPGlobusAdmin.content.replace(/\n/g, "<p>"));
1252
-
1253
- $('#content').text(WPGlobusAdmin.content);
1254
-
1255
- if (typeof WPGlobusVendor !== "undefined" && WPGlobusVendor.vendor.WPSEO ) {
1256
- if ( typeof wpglobus_wpseo !== "undefined" ) {
1257
- wpglobus_wpseo();
1258
- } else if ( 'undefined' !== typeof WPGlobusYoastSeo ) {
1259
- if ( 'undefined' !== typeof WPGlobusYoastSeoPremium ) {
1260
- /**
1261
- * @since WPGlobus 1.7.2
1262
- */
1263
- if ( WPGlobusYoastSeoPremium ) {
1264
- WPGlobusYoastSeoPremium.init();
1265
- }
1266
- }
1267
- /**
1268
- * @since Yoast SEO 3.0
1269
- */
1270
- WPGlobusYoastSeo.init();
1271
- }
1272
- }
1273
-
1274
- if ( WPGlobusAdmin.data.modify_excerpt ) {
1275
- /**
1276
- * Add excerpt fields from template.
1277
- */
1278
- var $excerpt = $( '#excerpt' );
1279
- $excerpt.addClass( 'hidden' ).css( {'display':'none'} );
1280
- $( WPGlobusAdmin.data.template ).insertAfter( $excerpt );
1281
- $( 'body' ).on( 'change', '.wpglobus-excerpt', function () {
1282
- var $t = $( this );
1283
- $excerpt.val( WPGlobusCore.getString( $excerpt.val(), $t.val(), $t.data('language') ) );
1284
- });
1285
- }
1286
-
1287
- /**
1288
- * wp_editor word count.
1289
- * from WordPress 4.3 @see \wp-admin\js\post.js
1290
- */
1291
- if ( typeof wp.utils !== 'undefined' && typeof wp.utils.WordCounter !== 'undefined' ) {
1292
- WPGlobusCoreData.wordCounter = {};
1293
-
1294
- var self = this, wpglobusEditors = {};
1295
-
1296
- $.each( WPGlobusCoreData.enabled_languages, function( i, l ){
1297
- if ( l == WPGlobusCoreData.default_language ) {
1298
- return true;
1299
- }
1300
- wpglobusEditors[i] = 'content_'+l;
1301
-
1302
- ( function( $, counter, l ) {
1303
- WPGlobusCoreData.wordCounter[ l ] = {};
1304
- WPGlobusCoreData.wordCounter[ l ][ 'counter' ] = counter;
1305
-
1306
- $( function() {
1307
-
1308
- WPGlobusCoreData.wordCounter[ l ][ 'content' ] = $( '#content_'+l );
1309
- WPGlobusCoreData.wordCounter[ l ][ 'count' ] = $( '#wp-word-count-'+l ).find( '.word-count-'+l );
1310
-
1311
- WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] = 0;
1312
-
1313
- function update( l ) {
1314
- var text, count;
1315
-
1316
- if ( typeof l === 'object' ) {
1317
-
1318
- if ( l == 'tinymce' ) {
1319
- /** wysiwyg editor */
1320
- l = self.getCurrentTab();
1321
- } else {
1322
- /** textarea */
1323
- l = l.target.id.replace( 'content_', '' );
1324
- }
1325
-
1326
- }
1327
-
1328
- if ( typeof WPGlobusCoreData.wordCounter[ l ] === 'undefined' ) {
1329
- return;
1330
- }
1331
-
1332
- if ( ! WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ] ||
1333
- WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ].isHidden() ) {
1334
-
1335
- text = WPGlobusCoreData.wordCounter[ l ][ 'content' ].val();
1336
-
1337
- } else {
1338
- text = WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ].getContent( { format: 'raw' } );
1339
- }
1340
-
1341
- count = WPGlobusCoreData.wordCounter[ l ][ 'counter' ].count( text );
1342
-
1343
- if ( count !== WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] ) {
1344
- WPGlobusCoreData.wordCounter[ l ][ 'count' ].text( count );
1345
- }
1346
-
1347
- WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] = count;
1348
- }
1349
-
1350
- $(document).on( 'tinymce-editor-init', function( event, editor ) {
1351
-
1352
- if ( -1 == $.inArray(editor.id, wpglobusEditors) ) {
1353
- /**
1354
- * Init WPGlobus editor only.
1355
- */
1356
- return;
1357
- }
1358
- var l = editor.id.replace( 'content_', '' );
1359
-
1360
- WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ] = editor;
1361
-
1362
- editor.on( 'nodechange keyup', _.debounce( update, 1000 ) );
1363
- } );
1364
-
1365
- WPGlobusCoreData.wordCounter[l]['content'].on( 'input keyup', _.debounce( update, 1000 ) );
1366
-
1367
- update( l );
1368
-
1369
- } );
1370
- } )( jQuery, new wp.utils.WordCounter(), l );
1371
- });
1372
-
1373
- }
1374
-
1375
- $(document).on('click', '#publish, #save-post', function() {
1376
- if ( WPGlobusAdmin.data.open_languages.length > 1 ) {
1377
- $(document).triggerHandler('wpglobus_before_save_post', {content_tabs_id:content_tabs_id});
1378
- /**
1379
- * If empty title in default language make it from another titles.
1380
- */
1381
- var t = $('#title').val(),
1382
- index, title = '', delimiter = '';
1383
-
1384
- if ( t.length == 0 ) {
1385
- index = WPGlobusAdmin.data.open_languages.indexOf(WPGlobusAdmin.data.default_language);
1386
- WPGlobusAdmin.data.open_languages.splice(index, 1);
1387
- $(WPGlobusAdmin.data.open_languages).each(function(i,l){
1388
- delimiter = i == 0 ? '' : '-';
1389
- t = $('#title_'+l).val();
1390
- if ( t.length > 0 ) {
1391
- if ( title.length == 0 ) { delimiter = '';}
1392
- title = title + delimiter + t;
1393
- }
1394
- });
1395
- }
1396
- if ( title.length > 0 ) {
1397
- $('#title').val(title);
1398
- }
1399
- }
1400
-
1401
- /**
1402
- * To handle taxonomy tags.
1403
- */
1404
- if ( 'undefined' === typeof WPGlobusAdmin.data.tagsdiv || WPGlobusAdmin.data.tagsdiv.length < 1 ) {
1405
- return;
1406
- }
1407
- $(WPGlobusAdmin.data.tagsdiv).each(function(i,tagsdiv){
1408
- if ($('#' + tagsdiv).length == 0) {
1409
- /**
1410
- * Next iteration.
1411
- */
1412
- return true;
1413
- }
1414
-
1415
- var id = tagsdiv.replace('tagsdiv-', '');
1416
- if ( 'undefined' === id ) {
1417
- return true;
1418
- }
1419
- if ( $('#tax-input-'+id).length == 0 ) {
1420
- return true;
1421
- }
1422
-
1423
- var name, tags = [];
1424
-
1425
- /**
1426
- * Obsolete from WP 4.9
1427
- * $('#tagsdiv-'+id+' .tagchecklist > span').each(function(i,e){
1428
- */
1429
- $('#tagsdiv-'+id+' .tagchecklist li').each(function(i,e){
1430
- name = $(e).html();
1431
- name = name.replace( /<button.*<\/button>&nbsp;/, '' );
1432
- if ( 'undefined' === typeof WPGlobusAdmin.data.tag[id][name] ) {
1433
- tags[i] = name;
1434
- } else {
1435
- tags[i] = WPGlobusAdmin.data.tag[id][name];
1436
- }
1437
- });
1438
-
1439
- $('#tax-input-'+id).val(tags.join(', '));
1440
- });
1441
- /**
1442
- * The end to handle taxonomy tags.
1443
- */
1444
- });
1445
-
1446
- /**
1447
- * The alignment when default tab was clicked.
1448
- */
1449
- $('.ui-state-default').on('click', function () {
1450
- if ('link-tab-default' === $(this).attr('id')) {
1451
- $(window).scrollTop($(window).scrollTop() + 1);
1452
- $(window).scrollTop($(window).scrollTop() - 1);
1453
- }
1454
- });
1455
-
1456
- /**
1457
- * Set current value after language tab of content was changed.
1458
- */
1459
- $(document).on( 'tabsactivate', content_tabs_id, function( event, ui ) {
1460
- WPGlobusAdmin.currentTab = ui.newTab[0].dataset.language;
1461
- });
1462
-
1463
- $(document).triggerHandler('wpglobus_after_post_edit');
1464
-
1465
- },
1466
- adminCentral: function () {
1467
- $( '.wpglobus-admin-central-tab' ).css({ 'display':'none' });
1468
-
1469
- if ( $( '.nav-tab-active' ).length > 1 ) {
1470
- $( '.wpglobus-about-wrap .nav-tab-wrapper a' ).removeClass( 'nav-tab-active' );
1471
- }
1472
-
1473
- var setFirstElement = true;
1474
- if ( 0 == location.hash.indexOf( '#' ) ) {
1475
- $( '.wpglobus-about-wrap .nav-tab-wrapper a').each( function( i, e ) {
1476
- if ( $(e).attr( 'href' ) == location.hash ) {
1477
- setFirstElement = false;
1478
- $(e).addClass( 'nav-tab-active' );
1479
- }
1480
- });
1481
- }
1482
- if ( setFirstElement ) {
1483
- $( '.wpglobus-about-wrap .nav-tab-wrapper a' ).eq(0).addClass( 'nav-tab-active' );
1484
- }
1485
-
1486
- var activePanel = $( '.wpglobus-about-wrap .nav-tab-active' ).data( 'tab-id' );
1487
- if ( '' != activePanel ) {
1488
- $( '#'+activePanel ).css({'display':'block'});
1489
- }
1490
-
1491
- $(document).on( 'click', '.wpglobus-about-wrap .nav-tab', function(event){
1492
- var $t = $( this );
1493
- if ( $t.hasClass( 'nav-tab-active' ) ) {
1494
- return;
1495
- }
1496
- $( '.wpglobus-admin-central-tab' ).css({ 'display':'none' });
1497
- $( '.wpglobus-about-wrap .nav-tab' ).removeClass( 'nav-tab-active' );
1498
- $t.addClass( 'nav-tab-active' );
1499
- if ( '' != $t.data( 'tab-id' ) ) {
1500
- $( '#' + $t.data( 'tab-id' ) ).css({ 'display':'block' });
1501
- }
1502
- });
1503
- },
1504
- start: function () {
1505
- var t = this;
1506
- $('#wpglobus_flags').select2({
1507
- formatResult: this.format,
1508
- formatSelection: this.format,
1509
- minimumResultsForSearch: -1,
1510
- escapeMarkup: function (m) {
1511
- return m;
1512
- }
1513
- });
1514
-
1515
- /** disable checked off first language */
1516
- $('body').on('click', '#enabled_languages-list li:first input', function (event) {
1517
- event.preventDefault();
1518
- $('.redux-save-warn').css({'display': 'none'});
1519
- $('#enabled_languages-list').find('li:first > input').val('1');
1520
- if ($('#disable_first_language').length === 0) {
1521
- $(t.config.disable_first_language).insertAfter('#info_bar');
1522
- }
1523
- return false;
1524
- });
1525
-
1526
- },
1527
- format: function (language) {
1528
- return '<img class="wpglobus_flag" src="' + WPGlobusAdmin.flag_url + language.text + '"/>&nbsp;&nbsp;' + language.text;
1529
- },
1530
- set_dialog: function() {
1531
-
1532
- if ( 'undefined' !== typeof WPGlobusAdmin.data.customFieldsEnabled ) {
1533
- WPGlobusAdmin.data.customFieldsEnabled = this.parseBool( WPGlobusAdmin.data.customFieldsEnabled );
1534
- if ( ! WPGlobusAdmin.data.customFieldsEnabled ) {
1535
- return;
1536
- }
1537
- }
1538
-
1539
- var ajaxify_row_id, added_control = false;
1540
- var add_elements = function(post_id) {
1541
-
1542
- var id, rows, cb, _cb,
1543
- _classes = 'wpglobus_dialog_start wpglobus_dialog_icon';
1544
-
1545
- _cb = [
1546
- '<div class="wpglobus_dialog_options_wrapper hidden">',
1547
- '<input style="width:initial;" id="wpglobus-cb-{{id}}" data-object="#wpglobus-dialog-start-{{id}}" data-meta-key="{{meta-key}}" class="wpglobus_dialog_option wpglobus_dialog_cb" type="checkbox" {{checked}} />',
1548
- '</div>'
1549
- ].join('');
1550
-
1551
- if (typeof post_id == 'undefined') {
1552
- rows = '#the-list tr';
1553
- } else {
1554
- rows = '#the-list tr#'+post_id;
1555
- }
1556
- $(rows).each(function(){
1557
- var $t = $(this),
1558
- tid = $t.attr('id'),
1559
- element = $t.find('textarea'),
1560
- clone, name, meta_key,
1561
- classes = _classes;
1562
-
1563
- id = element.attr('id');
1564
- if ( undefined === id ) {
1565
- return true;
1566
- }
1567
- meta_key = $('#'+tid+'-key').val();
1568
- clone = $('#'+id).clone();
1569
- $(element).addClass('wpglobus-dialog-field-source hidden');
1570
- name = element.attr('name');
1571
- $(clone).attr('id', 'wpglobus-'+id);
1572
- $(clone).attr('name', 'wpglobus-'+name);
1573
- $(clone).attr('data-source-id', id);
1574
- $(clone).attr('class', 'wpglobus-dialog-field');
1575
- $(clone).val( WPGlobusCore.TextFilter($(element).val(), WPGlobusCoreData.language) );
1576
- $(clone).insertAfter(element);
1577
- cb = _cb.replace(/{{id}}/g, id);
1578
- cb = cb.replace(/{{meta-key}}/g, meta_key);
1579
- if ( undefined === WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type] ) {
1580
- cb = cb.replace(/{{checked}}/, 'checked');
1581
- } else {
1582
- if ( undefined !== WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][meta_key] && WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][meta_key] == 'false' ) {
1583
- cb = cb.replace(/{{checked}}/, '');
1584
- classes = _classes+' wpglobus_dialog_start_hidden';
1585
- } else {
1586
- cb = cb.replace(/{{checked}}/, 'checked');
1587
- classes = _classes;
1588
- }
1589
- }
1590
- $t.append('<td style="width:20px;"><div id="wpglobus-dialog-start-'+id+'" data-type="control" data-source-type="textarea" data-source-id="'+id+'" class="'+classes+'"></div>'+cb+'</td>');
1591
- });
1592
- if ( ! added_control && $('#list-table .wpglobus_dialog_start').length > 0 ) {
1593
- $('#list-table thead tr').append('<th class="wpglobus-control-head"><div class="wpglobus_dialog_settings wpglobus_dialog_icon"></div></th>');
1594
- added_control = true;
1595
- }
1596
- }
1597
-
1598
- add_elements();
1599
-
1600
- $('body').on('change', '.wpglobus-dialog-field', function(){
1601
- var $t = $(this),
1602
- source_id = '#'+$t.data('source-id'),
1603
- source = '', s = '', new_value;
1604
-
1605
- if ( typeof source_id == 'undefined' ) {
1606
- return;
1607
- }
1608
- source = $(source_id).val();
1609
-
1610
- if ( ! /(\{:|\[:|<!--:)[a-z]{2}/.test(source) ) {
1611
- $(source_id).val($t.val());
1612
- } else {
1613
- $.each(WPGlobusCoreData.enabled_languages, function(i,l){
1614
- if ( l == WPGlobusCoreData.language ) {
1615
- new_value = $t.val();
1616
- } else {
1617
- new_value = WPGlobusCore.TextFilter(source,l,'RETURN_EMPTY');
1618
- }
1619
- if ( '' != new_value ) {
1620
- s = s + WPGlobusCore.addLocaleMarks(new_value,l);
1621
- }
1622
- });
1623
- $(source_id).val(s);
1624
- }
1625
-
1626
- });
1627
-
1628
- $(document).ajaxSend(function(event, jqxhr, settings){
1629
- if ( 'add-meta' == settings.action ) {
1630
- ajaxify_row_id = settings.element;
1631
- }
1632
- });
1633
- $(document).ajaxComplete(function(event, jqxhr, settings){
1634
- if ( 'add-meta' == settings.action && undefined !== jqxhr.responseXML ) {
1635
- if ( 'newmeta' == ajaxify_row_id ) {
1636
- add_elements('meta-'+$(jqxhr.responseXML.documentElement.outerHTML).find('meta').attr('id'));
1637
- } else {
1638
- add_elements(ajaxify_row_id);
1639
- }
1640
- }
1641
- });
1642
-
1643
- WPGlobusDialogApp.init({dialogTitle:'Edit meta'});
1644
-
1645
- }
1646
- };
1647
-
1648
- new WPGlobusAdminApp.App();
1649
-
1650
- return WPGlobusAdminApp;
1651
-
1652
- }(window.WPGlobusAdminApp || {}, jQuery));
1653
-
1654
- });
1
+ /**
2
+ * WPGlobus Administration Core, Dialog, Admin
3
+ * Interface JS functions
4
+ *
5
+ * @since 1.9.0
6
+ *
7
+ * @package WPGlobus
8
+ * @subpackage Administration
9
+ */
10
+ /*jslint browser: true*/
11
+ /*global jQuery, console, WPGlobusCore, WPGlobusDialogApp, WPGlobusAdmin, inlineEditPost */
12
+
13
+ var WPGlobusCore;
14
+
15
+ (function($) {
16
+ var api;
17
+ api = WPGlobusCore = {
18
+ strpos: function( haystack, needle, offset){
19
+ haystack = "" + haystack;
20
+ var i = haystack.indexOf( needle, offset );
21
+ return i >= 0 ? i : false;
22
+ },
23
+
24
+ TextFilter: function(text, language, return_in){
25
+ if ( typeof text == 'undefined' || '' === text ) { return text; }
26
+
27
+ var pos_start, pos_end, possible_delimiters = [], is_local_text_found = false;;
28
+
29
+ language = '' == language ? 'en' : language;
30
+ return_in = typeof return_in == 'undefined' || '' == return_in ? 'RETURN_IN_DEFAULT_LANGUAGE' : return_in;
31
+
32
+ possible_delimiters[0] = [];
33
+ possible_delimiters[0]['start'] = WPGlobusCoreData.locale_tag_start.replace('%s', language);
34
+ possible_delimiters[0]['end'] = WPGlobusCoreData.locale_tag_end;
35
+
36
+ possible_delimiters[1] = [];
37
+ possible_delimiters[1]['start'] = '<!--:'+language+'-->';
38
+ possible_delimiters[1]['end'] = '<!--:-->';
39
+
40
+ possible_delimiters[2] = [];
41
+ possible_delimiters[2]['start'] = '[:'+language+']';
42
+ possible_delimiters[2]['end'] = '[:';
43
+
44
+
45
+
46
+ for (var i = 0; i < 3; i++) {
47
+
48
+ pos_start = api.strpos( text, possible_delimiters[i]['start'] );
49
+ if ( pos_start === false ) {
50
+ continue;
51
+ }
52
+
53
+ pos_start = pos_start + possible_delimiters[i]['start'].length;
54
+
55
+ pos_end = api.strpos( text, possible_delimiters[i]['end'], pos_start );
56
+
57
+ if ( pos_end === false ) {
58
+ text = text.substr( pos_start );
59
+ } else {
60
+ text = text.substr( pos_start, pos_end - pos_start );
61
+ }
62
+
63
+ is_local_text_found = true;
64
+ break;
65
+
66
+ }
67
+
68
+ if ( ! is_local_text_found ) {
69
+ if ( return_in == 'RETURN_EMPTY' ) {
70
+ if ( language == WPGlobusCoreData.default_language && ! /(\{:|\[:|<!--:)[a-z]{2}/.test(text) ) {
71
+ /** do nothing */
72
+ } else {
73
+ text = '';
74
+ }
75
+ } else {
76
+ /**
77
+ * Try RETURN_IN_DEFAULT_LANGUAGE.
78
+ */
79
+ if ( language == WPGlobusCoreData.default_language ) {
80
+ if ( /(\{:|\[:|<!--:)[a-z]{2}/.test(text) ) {
81
+ text = '';
82
+ }
83
+ } else {
84
+ text = api.TextFilter( text, WPGlobusCoreData.default_language );
85
+ }
86
+ }
87
+ }
88
+ return text;
89
+ },
90
+ addLocaleMarks: function(text, language) {
91
+ return WPGlobusCoreData.locale_tag_start.replace('%s', language) + text + WPGlobusCoreData.locale_tag_end;
92
+ },
93
+ getTranslations: function(text) {
94
+ var t = {},
95
+ return_in;
96
+ $.each(WPGlobusCoreData.enabled_languages, function(i,l){
97
+ return_in = l == WPGlobusCoreData.default_language ? 'RETURN_IN_DEFAULT_LANGUAGE' : 'RETURN_EMPTY';
98
+ t[l] = api.TextFilter(text, l, return_in);
99
+ });
100
+ return t;
101
+ },
102
+ getString: function(s, newVal, l) {
103
+ if ( 'undefined' === typeof(s) ) {
104
+ return s;
105
+ }
106
+ if ( 'undefined' === typeof(newVal) ) {
107
+ newVal = '';
108
+ }
109
+ if ( 'undefined' === typeof(l) ) {
110
+ l = WPGlobusCoreData.language;
111
+ }
112
+
113
+ s = api.getTranslations(s);
114
+ s[l] = newVal;
115
+
116
+ var cS = '';
117
+
118
+ $.each(s, function(ln,val){
119
+ if ( '' != val && ln != WPGlobusCoreData.default_language) {
120
+ cS += api.addLocaleMarks(val, ln);
121
+ }
122
+ });
123
+
124
+ if ( '' != s[WPGlobusCoreData.default_language] ) {
125
+ if ( '' == cS ) {
126
+ cS = s[WPGlobusCoreData.default_language];
127
+ } else {
128
+ cS = api.addLocaleMarks(s[WPGlobusCoreData.default_language], WPGlobusCoreData.default_language) + cS;
129
+ }
130
+ }
131
+ return cS;
132
+ }
133
+ };
134
+ })(jQuery);
135
+
136
+ var WPGlobusDialogApp;
137
+
138
+ (function($) {
139
+
140
+ var api;
141
+ api = WPGlobusDialogApp = {
142
+ option : {
143
+ listenClass : '.wpglobus_dialog_start',
144
+ settingsClass : '.wpglobus_dialog_settings',
145
+ dialogTabs: '#wpglobus-dialog-tabs',
146
+ dialogTitle: '',
147
+ customData: null,
148
+ callback: function(){},
149
+ dialogOptions: {
150
+ title: '',
151
+ placeholder: '',
152
+ formFooter: '',
153
+ beforeOpen: function(){},
154
+ close: function(){},
155
+ },
156
+ dialog: {}
157
+ },
158
+ form : undefined,
159
+ element : undefined,
160
+ element_by : 'id',
161
+ id : '',
162
+ clone_id: '',
163
+ wpglobus_id : '',
164
+ type : 'textarea',
165
+ source : '',
166
+ order : {},
167
+ value : {},
168
+ request : 'core',
169
+ attrs: {},
170
+ dialogTitle: '',
171
+ trClass: 'wpglobus-translatable',
172
+ startButton: [
173
+ '<span id="wpglobus-dialog-start-{{clone_id}}" ',
174
+ 'style="{{style}}" ',
175
+ 'data-type="control" data-dialog-title="{{title}}" ',
176
+ 'data-source-type="" data-source-id="{{id}}" data-source-name="{{name}}" ',
177
+ 'data-nodename="{{nodename}}"',
178
+ '{{sbTitle}} ',
179
+ 'class="{{classes}}"></span>'
180
+ ].join(''),
181
+ startButtonClass : 'wpglobus_dialog_start wpglobus_dialog_icon',
182
+ clicks: 0,
183
+ init: function(args) {
184
+ api.option.dialog = api.option.dialogOptions;
185
+ api.option = $.extend(api.option, args);
186
+ $(api.option.dialogTabs).tabs();
187
+ api.dialogTitle = api.option.dialogTitle;
188
+ this.attachListener();
189
+ if ( api.option.customData != null && typeof api.option.customData.addElements != 'undefined' ) {
190
+ $.each(api.option.customData.addElements, function(i,e) {
191
+ api.addElement(e);
192
+ });
193
+ }
194
+ },
195
+ convertToId: function(s){
196
+ s = s.replace(/\]/g,'');
197
+ s = s.replace(/\[/g,'-');
198
+ return s;
199
+ },
200
+ addElement: function(elem) {
201
+ var option = {
202
+ id: null,
203
+ style: '',
204
+ styleTextareaWrapper: '',
205
+ sbTitle: '',
206
+ onChangeClass: '',
207
+ dialogTitle: '',
208
+ dialog: api.option.dialogOptions
209
+ }
210
+ if ( 'string' == typeof(elem) ) {
211
+ option.id = elem;
212
+ } else if ( 'object' == typeof(elem) ) {
213
+ option = $.extend(option, elem);
214
+ } else {
215
+ return;
216
+ }
217
+
218
+ var $element = null, id = null, name = null, node = null,
219
+ sb = api.startButton,
220
+ clone, v, style, nodeName = '';
221
+
222
+ api.element_by = 'name';
223
+ node = document.getElementsByName(option.id);
224
+
225
+ if ( 0 == node.length ) {
226
+ api.element_by = 'id';
227
+ node = document.getElementById(option.id);
228
+ }
229
+
230
+ if ( null === node ) {
231
+ return;
232
+ } else {
233
+ id = option.id;
234
+ if ( 'id' == api.element_by ) {
235
+ $element = $('#'+id);
236
+ } else {
237
+ nodeName = node[0].nodeName;
238
+ nodeName = nodeName.toLowerCase();
239
+ $element = $(nodeName+'[name="'+id+'"]');
240
+ }
241
+ }
242
+
243
+ if ( 'undefined' === typeof $element.attr('name') || '' == $element.attr('name') ) {
244
+ name = id;
245
+ } else {
246
+ name = $element.attr('name');
247
+ }
248
+ api.clone_id = api.convertToId(id);
249
+
250
+ if ( -1 != name.indexOf( 'wpglobus' ) || -1 != api.clone_id.indexOf( 'wpglobus' ) ) {
251
+ /**
252
+ * To prevent add element to itself.
253
+ */
254
+ return false;
255
+ }
256
+
257
+ if ( $( '#wpglobus-'+api.clone_id ).length > 0 ) {
258
+ /**
259
+ * WPGlobus element exists already.
260
+ */
261
+ return false;
262
+ }
263
+ if ( $( nodeName+'[name="wpglobus-'+name+'"]' ).length > 0 ) {
264
+ /**
265
+ * WPGlobus element exists already.
266
+ */
267
+ return false;
268
+ }
269
+
270
+ clone = $( $element.clone() );
271
+ //$element.addClass('hidden');
272
+ style = $element.attr('style') || '';
273
+ $element.attr( 'style', 'display:none;' );
274
+ clone.attr( 'id', 'wpglobus-'+api.clone_id ).attr( 'name', 'wpglobus-'+name );
275
+
276
+ /**
277
+ * Add WPGlobus translatable class.
278
+ */
279
+ clone.addClass( api.trClass );
280
+
281
+ if ( option.onChangeClass != '' ) {
282
+ /**
283
+ * add class to bind 'change' event
284
+ */
285
+ clone.addClass( option.onChangeClass );
286
+ }
287
+
288
+ if ( 'id' == api.element_by ) {
289
+ clone.attr('data-source-id', id).attr('data-source-name', '').attr('data-source-get-by',api.element_by);
290
+ } else {
291
+ clone.attr('data-source-id', '').attr('data-source-name', name).attr('data-source-get-by',api.element_by);
292
+ }
293
+
294
+ if ( 'textarea' == nodeName ) {
295
+ v = WPGlobusCore.getTranslations( $element.val() )[WPGlobusCoreData['language']];
296
+ clone.val( v );
297
+ clone.attr( 'data-nodename', 'textarea' );
298
+ if ( '' == option.style ) {
299
+ clone.attr( 'style', style + ';width:95%;float:left;' );
300
+ } else {
301
+ clone.attr( 'style', style + ';' + option.style );
302
+ }
303
+ } else {
304
+ v = WPGlobusCore.getTranslations( $element.val() )[WPGlobusCoreData['language']];
305
+ clone.attr( 'value', v );
306
+ clone.attr( 'data-nodename', 'input' );
307
+ if ( '' != option.style ) {
308
+ clone.attr( 'style', style + ';' + option.style );
309
+ }
310
+ }
311
+
312
+ /**
313
+ * Add dialog options.
314
+ * @since 1.7.12
315
+ */
316
+ if ( '' != option.dialog ) {
317
+ clone.attr( 'data-dialog', JSON.stringify(option.dialog) );
318
+ }
319
+
320
+ sb = sb.replace(/{{clone_id}}/g, api.clone_id);
321
+ if ( 'id' == api.element_by ) {
322
+ sb = sb.replace(/{{id}}/g, api.clone_id);
323
+ sb = sb.replace(/{{name}}/g, '');
324
+ sb = sb.replace(/{{nodename}}/g, '');
325
+ } else {
326
+ sb = sb.replace(/{{id}}/g, '');
327
+ sb = sb.replace(/{{name}}/g, name);
328
+ sb = sb.replace(/{{nodename}}/g, nodeName);
329
+ }
330
+ sb = 'textarea' == nodeName ? sb.replace( '{{style}}', 'float:left;margin-top:0;' ) : sb.replace( '{{style}}', '' );
331
+ var startButtonClasses = 'textarea' == nodeName ? api.startButtonClass + ' wpglobus-textarea wpglobus-textarea-'+api.clone_id : api.startButtonClass;
332
+ sb = sb.replace( '{{classes}}', startButtonClasses );
333
+ sb = option.dialogTitle == '' ? sb.replace('{{title}}', api.dialogTitle) : sb.replace('{{title}}', option.dialogTitle);
334
+ sb = option.sbTitle == '' ? sb.replace('{{sbTitle}}', option.sbTitle) : sb.replace('{{sbTitle}}', 'title="'+option.sbTitle+'"');
335
+
336
+ $(sb).insertAfter($element);
337
+ $(clone).insertAfter($element);
338
+
339
+ if ( 'textarea' == nodeName ) {
340
+ $('#wpglobus-'+api.clone_id).addClass( 'wpglobus-textarea-'+api.clone_id );
341
+ $('.wpglobus-textarea-'+api.clone_id).wrapAll( '<div class="wpglobus-textarea-wrapper" style="'+option.styleTextareaWrapper+'"></div>' );
342
+ }
343
+
344
+ /**
345
+ * Bind change event
346
+ */
347
+ var selector, ret = false;
348
+ if ( option.onChangeClass == '' ) {
349
+ selector = '#wpglobus-' + api.clone_id;
350
+ } else {
351
+ selector = '.' + option.onChangeClass;
352
+ var $events = $._data( $(document)[0], 'events' );
353
+ if( typeof $events === 'undefined' ){
354
+ ret = true;
355
+ } else {
356
+ if ( typeof $events.change !== 'undefined' ) {
357
+ $.each( $events.change, function(i, ev){
358
+ if ( ev.selector == selector ) {
359
+ ret = true;
360
+ return false;
361
+ }
362
+ });
363
+ }
364
+ }
365
+ }
366
+
367
+ if ( ret ) {
368
+ /**
369
+ * Return because we had bound 'change' event already.
370
+ */
371
+ return true;
372
+ }
373
+
374
+ $(document).on( 'change', selector, function() {
375
+ var $t = $(this),
376
+ sid = $t.data( 'source-id' );
377
+
378
+ if ( '' == sid ) {
379
+ sid = $t.data( 'nodename' ) + '[name="' + $t.data( 'source-name' ) + '"]';
380
+ } else {
381
+ sid = '#' + sid;
382
+ }
383
+ $(sid).val( WPGlobusCore.getString( $(sid).val(), $t.val() ) );
384
+ });
385
+ return true;
386
+ },
387
+ saveDialog: function() {
388
+ var s = '', sdl = '', scl = '', $e, val, l;
389
+ $('.wpglobus_dialog_textarea').each(function(indx,e){
390
+ $e = $(e);
391
+ val = $e.val();
392
+ l = $e.data('language');
393
+ if ( l == WPGlobusAdmin.data.language ) {
394
+ scl = val;
395
+ }
396
+ if ( val != '' ) {
397
+ s = s + WPGlobusCore.addLocaleMarks(val,l);
398
+ if ( l == WPGlobusCoreData.default_language ) {
399
+ sdl = val;
400
+ }
401
+ }
402
+ });
403
+ s = s.length == sdl.length + 8 ? sdl : s;
404
+ $(api.id).val(s);
405
+ s = scl == '' ? sdl : scl;
406
+ $(api.wpglobus_id).val(s);
407
+ },
408
+ dialog : $('#wpglobus-dialog-wrapper').dialog({
409
+ autoOpen: false,
410
+ //height: 250,
411
+ width: 650,
412
+ modal: true,
413
+ dialogClass: 'wpglobus-dialog',
414
+ buttons: [
415
+ {
416
+ text:'Save',
417
+ class: 'wpglobus-button-save',
418
+ click:function(){api.saveDialog(); api.dialog.dialog('close');}
419
+ },
420
+ {
421
+ text:'Cancel',
422
+ class: 'wpglobus-button-cancel',
423
+ click: function(){api.dialog.dialog('close');}
424
+ }
425
+ ],
426
+ open: function( event, ui ) {
427
+ var title = api.dialogTitle;
428
+ if ( typeof api.attrs.maxlength !== 'undefined' ) {
429
+ $('.wpglobus_dialog_textarea').attr('maxlength', api.attrs.maxlength);
430
+ title += ' | maxlength='+api.attrs.maxlength;
431
+ }
432
+ $('.wpglobus-dialog .ui-dialog-title').text(title);
433
+ },
434
+ close: function() {
435
+ /**
436
+ * Close callback.
437
+ */
438
+ api.runCallback( api.option.dialog.close );
439
+
440
+ api.form[0].reset();
441
+ //allFields.removeClass( "ui-state-error" );
442
+ }
443
+ }),
444
+ attachListener : function() {
445
+ $(document).on('click', api.option.settingsClass, function() {
446
+ if ( $('.wpglobus_dialog_options_wrapper').hasClass('hidden') ) {
447
+ $('.wpglobus_dialog_options_wrapper').removeClass('hidden');
448
+ } else {
449
+ $('.wpglobus_dialog_options_wrapper').addClass('hidden');
450
+ }
451
+ });
452
+ $(document).on('click', '.wpglobus_dialog_option', function(event) {
453
+ var $t = $(this), r;
454
+ var ob = $t.data('object');
455
+ api.order['action'] = 'save_post_meta_settings';
456
+ api.order['post_type'] = WPGlobusAdmin.data.post_type;
457
+ api.order['checked'] = $t.prop('checked');
458
+ api.order['id'] = $t.attr('id');
459
+ api.order['meta_key'] = $t.data('meta-key');
460
+ r = api.ajax(api.order);
461
+ r.done(function (result) {
462
+ if ( result.result == 'ok' ) {
463
+ if ( result.checked == 'true' ) {
464
+ $(ob).removeClass('wpglobus_dialog_start_hidden');
465
+ } else {
466
+ $(ob).addClass('wpglobus_dialog_start_hidden');
467
+ }
468
+ }
469
+ })
470
+ .fail(function (error) {})
471
+ .always(function (jqXHR, status){});
472
+ });
473
+ $(document).on('click', api.option.listenClass, function(e) {
474
+ api.element = $(this);
475
+ api.id = api.element.data('source-id');
476
+ if ( '' == api.id ) {
477
+ api.id = api.element.data('nodename') + '[name="'+api.element.data('source-name')+'"]';
478
+ api.wpglobus_id = '#wpglobus-'+api.convertToId( api.element.data('source-name') );
479
+ } else {
480
+ api.wpglobus_id = '#wpglobus-'+api.id;
481
+ api.id = '#'+api.id;
482
+ }
483
+
484
+ api.clicks++;
485
+ if ( api.clicks == 1 ) {
486
+ setTimeout(function () {
487
+ if (api.clicks == 1) {
488
+ api.onClick(e);
489
+ } else {
490
+ var s = $(api.id);
491
+ if ( s.hasClass('hidden') ) {
492
+ s.removeClass('hidden').attr('style', 'display:block;');
493
+ } else {
494
+ s.addClass('hidden').attr('style', 'display:none;');
495
+ }
496
+ }
497
+ api.clicks = 0;
498
+ }, 200);
499
+ }
500
+ });
501
+ api.form = api.dialog.find('form#wpglobus-dialog-form').on('submit', function( event ) {
502
+ event.preventDefault();
503
+ api.saveDialog();
504
+ });
505
+ },
506
+ ajax : function(order) {
507
+ return $.ajax({type:'POST', url:WPGlobusAdmin.ajaxurl, data:{action:WPGlobusAdmin.process_ajax, order:order}, dataType:'json', async:false});
508
+ },
509
+ onClick: function(ev) {
510
+ if ( typeof(api.element.data('dialog-title')) == 'undefined' || '' == api.element.data('dialog-title') ) {
511
+ api.dialogTitle = api.option.dialogTitle;
512
+ } else {
513
+ api.dialogTitle = api.element.data('dialog-title');
514
+ }
515
+ if ( typeof api.id !== 'undefined' ) {
516
+ api.attrs['maxlength'] = $(api.id).attr('maxlength');
517
+ }
518
+
519
+ api.source = api.element.data('source-value');
520
+ if ( typeof api.source === 'undefined' ) {
521
+ api.source = $(api.id).val();
522
+ if (api.request == 'ajax') {
523
+ // @todo revise ajax action
524
+ //api.order['action'] = 'get_translate';
525
+ //api.order['source'] = api.source;
526
+ //api.ajax(api.order);
527
+ } else {
528
+ api.value = WPGlobusCore.getTranslations(api.source);
529
+ }
530
+ }
531
+
532
+ /**
533
+ * Get dialog form options.
534
+ */
535
+ api.option.dialog = $.extend( {}, api.option.dialogOptions, $(api.wpglobus_id).data('dialog') );
536
+
537
+ if ( '' != api.option.dialog.title ) {
538
+ api.dialogTitle = api.option.dialog.title;
539
+ }
540
+
541
+ $.each(api.value, function(l,e){
542
+ var $d = $('#wpglobus-dialog-'+l);
543
+ /**
544
+ * Value.
545
+ */
546
+ $d.val(e);
547
+
548
+ /**
549
+ * Placeholder.
550
+ */
551
+ $d.attr(
552
+ 'placeholder',
553
+ WPGlobusCore.TextFilter( api.option.dialog.placeholder, l, 'RETURN_IN_DEFAULT_LANGUAGE' )
554
+ );
555
+ });
556
+
557
+ /**
558
+ * Dialog form footer.
559
+ */
560
+ $('#wpglobus-dialog-form-footer').html(api.option.dialog.formFooter);
561
+
562
+ /**
563
+ * Before open callback.
564
+ */
565
+ api.runCallback( api.option.dialog.beforeOpen );
566
+
567
+ api.dialog.dialog('open');
568
+ },
569
+ runCallback: function(callback) {
570
+
571
+ if ( 'object' === typeof callback ) {
572
+ var k = Object.keys(callback)[0];
573
+ var fn = callback[Object.keys(callback)[0]]
574
+ if ( 'window' === k ) {
575
+ if ( 'function' === typeof window[fn] ) {
576
+ window[fn]( callback[Object.keys(callback)[1]] );
577
+ }
578
+ } else if ( 'function' === typeof window[k][fn] ) {
579
+ window[k][fn]( callback[Object.keys(callback)[1]] );
580
+ }
581
+ } else if ( 'string' === typeof callback ) {
582
+ if ( 'function' === typeof window[callback] ) {
583
+ window[callback]();
584
+ }
585
+ }
586
+
587
+ }
588
+ };
589
+
590
+ })(jQuery);
591
+
592
+ jQuery(document).ready(function () {
593
+ "use strict";
594
+ window.WPGlobusAdminApp = (function (WPGlobusAdminApp, $) {
595
+ /* Object Constructor
596
+ ========================*/
597
+ WPGlobusAdminApp.App = function (config) {
598
+
599
+ if ( 'undefined' !== typeof window.WPGlobusAdminApp ) {
600
+ return;
601
+ }
602
+
603
+ this.config = {
604
+ debug: false,
605
+ version: WPGlobusAdmin.version
606
+ };
607
+
608
+ this.status = 'ok';
609
+
610
+ if ( 'undefined' === typeof WPGlobusAdmin ) {
611
+ this.status = 'error';
612
+ if (this.config.debug) {
613
+ console.log('WPGlobus: error options loading');
614
+ }
615
+ } else {
616
+ if (this.config.debug) {
617
+ console.dir(WPGlobusAdmin);
618
+ }
619
+ }
620
+
621
+ this.config.disable_first_language = [
622
+ '<div id="disable_first_language" style="display:block;" class="redux-field-errors notice-red">',
623
+ '<strong>',
624
+ '<span>&nbsp;</span>',
625
+ WPGlobusAdmin.i18n.cannot_disable_language,
626
+ '</strong>',
627
+ '</div>'
628
+ ].join('');
629
+
630
+ $.extend(this.config, config);
631
+
632
+ if ('ok' === this.status) {
633
+ this.init();
634
+ }
635
+ };
636
+
637
+ WPGlobusAdminApp.App.prototype = {
638
+ $document : $(document),
639
+ init: function () {
640
+ WPGlobusCoreData.multisite = this.parseBool(WPGlobusCoreData.multisite);
641
+ this.adminInit();
642
+ $('#content').addClass('wpglobus-editor').attr('data-language',WPGlobusAdmin.data.default_language);
643
+ $('textarea[id^=content_]').each(function(i,e){
644
+ var l=$(e).attr('id').replace('content_','');
645
+ $(e).attr('data-language',l);
646
+ });
647
+ if ('post.php' === WPGlobusAdmin.page) {
648
+ this.postEdit();
649
+ this.set_dialog();
650
+ if ( 'undefined' !== typeof WPGlobusAioseop ) {
651
+ WPGlobusAioseop.init();
652
+ }
653
+ } else if ('menu-edit' === WPGlobusAdmin.page) {
654
+ this.navMenus();
655
+ } else if ('taxonomy-edit' === WPGlobusAdmin.page) {
656
+ if (WPGlobusAdmin.data.tag_id) {
657
+ this.taxonomyEdit();
658
+ }
659
+ } else if ('taxonomy-quick-edit' === WPGlobusAdmin.page) {
660
+ this.quickEdit('taxonomy');
661
+ } else if ('edit.php' === WPGlobusAdmin.page) {
662
+ this.quickEdit('post');
663
+ } else if ('options-general.php' == WPGlobusAdmin.page) {
664
+ this.optionsGeneral();
665
+ WPGlobusDialogApp.init({customData:WPGlobusCoreData.page_custom_data});
666
+ } else if ('widgets.php' == WPGlobusAdmin.page) {
667
+ WPGlobusWidgets.init();
668
+ WPGlobusDialogApp.init({dialogTitle:'Edit text'});
669
+ } else if ('wpglobus_options' == WPGlobusAdmin.page) {
670
+ this.start();
671
+ } else if ('wpglobusAdminCentral' == WPGlobusAdmin.page) {
672
+ this.adminCentral();
673
+ } else {
674
+ /**
675
+ * Init WPGlobusDialogApp for using in a 3-party plugins.
676
+ */
677
+ WPGlobusDialogApp.init({customData:WPGlobusCoreData.page_custom_data});
678
+ }
679
+ },
680
+ parseBool: function(b) {
681
+ return !(/^(false|0)$/i).test(b) && !!b;
682
+ },
683
+ getCurrentTab: function() {
684
+ return $( '.wpglobus-post-body-tabs-list .ui-tabs-active' ).data( 'language' );
685
+ },
686
+ adminInit: function () {
687
+ var order = $('.wpglobus-addons-group a').data('key');
688
+ if ( 'undefined' !== typeof order ) {
689
+ if ( window.location.search.indexOf('page=wpglobus_options&tab='+order) >= 0 ) {
690
+ if ( WPGlobusCoreData.multisite ) {
691
+ window.location = WPGlobusCoreData.pluginInstallLocation.multisite;
692
+ } else {
693
+ window.location = WPGlobusCoreData.pluginInstallLocation.single;
694
+ }
695
+ } else {
696
+ var addon = $('#toplevel_page_wpglobus_options li').eq(order+1);
697
+ if ( WPGlobusCoreData.multisite ) {
698
+ $(addon).find('a').attr('href',WPGlobusCoreData.pluginInstallLocation.multisite).attr('onclick',"window.location=jQuery(this).attr('href');return false;");
699
+ } else {
700
+ $(addon).find('a').attr('href',WPGlobusCoreData.pluginInstallLocation.single).attr('onclick',"window.location=jQuery(this).attr('href');return false;");
701
+ }
702
+ }
703
+ }
704
+ },
705
+ optionsGeneral: function() {
706
+ var $bn = $('#blogname'),
707
+ $body = $('body');
708
+
709
+ $bn.addClass('hidden');
710
+ $('#wpglobus-blogname').insertAfter($bn).removeClass('hidden');
711
+
712
+ $body.on('blur', '.wpglobus-blogname', function () {
713
+ $('.wpglobus-blogname').each( function (i, e) {
714
+ var $e = $(e);
715
+ $bn.val( WPGlobusCore.getString( $bn.val(), $e.val(), $e.data('language') ) );
716
+ });
717
+ });
718
+
719
+ var $bd = $('#blogdescription');
720
+ $bd.addClass('hidden');
721
+ $('#wpglobus-blogdescription').insertAfter($bd).removeClass('hidden');
722
+ $body.on('blur', '.wpglobus-blogdesc', function () {
723
+ $('.wpglobus-blogdesc').each( function (i, e) {
724
+ var $e = $(e);
725
+ $bd.val( WPGlobusCore.getString( $bd.val(), $e.val(), $e.data('language') ) );
726
+ });
727
+ });
728
+ },
729
+ quickEdit: function(type) {
730
+ /**
731
+ * For more info @see ajax handler 'wp_ajax_inline_save'.
732
+ */
733
+ if ( 'undefined' === typeof WPGlobusAdmin.data.has_items ) {
734
+ return;
735
+ }
736
+ if (!WPGlobusAdmin.data.has_items) {
737
+ return;
738
+ }
739
+ var full_id = '', id = 0;
740
+
741
+ $(document).ajaxComplete(function(event, jqxhr, settings){
742
+ if (typeof settings.data === 'undefined') {
743
+ return;
744
+ }
745
+ if ( full_id == '' ) {
746
+ return;
747
+ }
748
+ if (settings.data.indexOf('action=inline-save-tax&') >= 0) {
749
+ $('#'+full_id+' a.row-title').text(WPGlobusAdmin.qedit_titles[id][WPGlobusAdmin.data.language]['name']);
750
+ $('#'+full_id+' .description').text(WPGlobusAdmin.qedit_titles[id][WPGlobusAdmin.data.language]['description']);
751
+ }
752
+ });
753
+
754
+ var title = {};
755
+ $('#the-list tr').each(function (i, e) {
756
+ var $e = $(e);
757
+ var k = ( type === 'post' ? 'post-' : 'tag-' );
758
+ id = $e.attr('id').replace(k, ''); /* don't need var with id, see line 109 */
759
+ title[id] = {};
760
+ if ('post' === type) {
761
+ title[id]['source'] = $e.find('.post_title').text();
762
+ } else if ('taxonomy' === type) {
763
+ title[id]['source'] = $('#inline_' + id + ' .name').text();
764
+ }
765
+ });
766
+
767
+ var order = {};
768
+ order['action'] = 'get_titles';
769
+ order['type'] = type;
770
+ order['taxonomy'] = typeof WPGlobusAdmin.data.taxonomy === 'undefined' ? false : WPGlobusAdmin.data.taxonomy;
771
+ order['title'] = title;
772
+ $.ajax({type:'POST', url:WPGlobusAdmin.ajaxurl, data:{action:WPGlobusAdmin.process_ajax, order:order}, dataType:'json'})
773
+ .done(function (result) {
774
+ WPGlobusAdmin.qedit_titles = result.qedit_titles;
775
+ $.each(result.bulkedit_post_titles, function(id, obj){
776
+ $('#inline_'+id+' .post_title').text(obj[WPGlobusAdmin.data.language]['name']);
777
+ });
778
+ })
779
+ .fail(function (error) {
780
+ })
781
+ .always(function (jqXHR, status) {
782
+ });
783
+
784
+ $('body').on('change', '.wpglobus-quick-edit-title', function () {
785
+ var s = '';
786
+ var lang = [];
787
+ $('.wpglobus-quick-edit-title').each(function (index, e) {
788
+ var $e = $(e);
789
+ var l = $e.data('language');
790
+ if ($e.val() !== '') {
791
+ s = WPGlobusCore.getString( s, $e.val(), l );
792
+ }
793
+ WPGlobusAdmin.qedit_titles[ id ][ l ][ 'name' ] = $e.val();
794
+ lang[ index ] = l;
795
+ });
796
+
797
+ var so = $(document).triggerHandler( 'wpglobus_get_translations', {string:s, lang:lang, id:id} );
798
+ if ( typeof so !== 'undefined' ) {
799
+ s = so;
800
+ }
801
+ $( 'input.ptitle' ).eq( 0 ).attr( 'value', s ) ;
802
+ WPGlobusAdmin.qedit_titles[ id ][ 'source' ] = s;
803
+ });
804
+
805
+ if ( typeof WPGlobusAdmin.data.tags !== 'undefined' ) {
806
+ $.each( WPGlobusAdmin.data.tags, function(i,tag){
807
+ WPGlobusAdmin.data.value[tag]['post_id'] = {};
808
+ });
809
+ }
810
+
811
+ $('button.save, input#bulk_edit').on('mouseenter', function (event) {
812
+ /**
813
+ * Quick edit action for the "Tags" box in edit.php page.
814
+ */
815
+ if ( typeof WPGlobusAdmin.data.tags === 'undefined' ) {
816
+ return;
817
+ }
818
+
819
+ if (event.currentTarget.id=='bulk_edit') {
820
+ $('input#bulk_edit').unbind('click');
821
+ } else {
822
+ $('button.save').unbind('click');
823
+ }
824
+
825
+ $( 'button.save, input#bulk_edit').on('click', function (event) {
826
+ //console.log( 'Start Updating' );
827
+ var promise = $.when();
828
+
829
+ var tagsHandler = function( $elem ) {
830
+ $elem.next('.spinner').css({'visibility':'visible'});
831
+ if (event.currentTarget.id != 'bulk_edit') {
832
+ $.ajaxSetup({async:false});
833
+ }
834
+ var p = $elem.parents('tr');
835
+ var id = p.attr('id').replace('edit-','');
836
+ var t,v,newTags;
837
+
838
+ $.each( WPGlobusAdmin.data.tags, function(index,tag){
839
+ t = p.find("textarea[name='" + WPGlobusAdmin.data.names[tag] + "']");
840
+ if ( t.length == 0 ) {
841
+ return true;
842
+ }
843
+ WPGlobusAdmin.data.value[tag]['post_id'][id] = t.val();
844
+ v = WPGlobusAdmin.data.value[tag]['post_id'][id].split(',');
845
+ newTags = [];
846
+ for(var i=0; i<v.length; i++) {
847
+ v[i] = v[i].trim(' ');
848
+ if ( v[i] != '' ) {
849
+ if ( typeof WPGlobusAdmin.data.tag[tag][v[i]] === 'undefined' ) {
850
+ newTags[i] = v[i];
851
+ } else {
852
+ newTags[i] = WPGlobusAdmin.data.tag[tag][v[i]];
853
+ }
854
+ }
855
+ }
856
+ t.val( newTags.join(', ') );
857
+ });
858
+ }
859
+
860
+ var $this = $(this);
861
+ var start = $.Deferred();
862
+ start.resolve( tagsHandler( $(this) ) );
863
+
864
+ promise = promise.then(function() {
865
+ return $.when(
866
+ start.done()
867
+ )
868
+ }).then( function() {
869
+ if (event.currentTarget.id != 'bulk_edit') {
870
+ setTimeout(
871
+ function() {
872
+ inlineEditPost.save(id);
873
+ $.ajaxSetup({async:true});
874
+ },
875
+ 50
876
+ );
877
+ }
878
+ });
879
+
880
+ });
881
+ });
882
+
883
+ $( '#the-list' ).on( 'click', 'a.editinline', function () {
884
+ var t = $(this);
885
+ full_id = t.parents('tr').attr('id');
886
+ if ('post' === type) {
887
+ id = full_id.replace('post-', '');
888
+ } else if ('taxonomy' === type) {
889
+ id = full_id.replace('tag-', '');
890
+ } else {
891
+ return;
892
+ }
893
+
894
+ if ( 'post' === type && 'undefined' !== typeof WPGlobusAdmin.data.tags ) {
895
+ /**
896
+ * @since 1.6.6
897
+ */
898
+ $.each( WPGlobusAdmin.data.tags, function(i,tag){
899
+ if ( WPGlobusAdmin.data.value[tag] != '' ) {
900
+ var val = $('#edit-' + id + ' textarea[name="' + WPGlobusAdmin.data.names[tag] + '"]').val(),
901
+ currentTags;
902
+ if ( 'undefined' !== typeof val ) {
903
+ currentTags = val.split(',');
904
+ $.each( currentTags, function(order,currentTag) {
905
+ val = val.replace(currentTag, WPGlobusCore.TextFilter(currentTag, WPGlobusCoreData.language));
906
+ });
907
+ $('#edit-' + id + ' textarea[name="' + WPGlobusAdmin.data.names[tag] + '"]').val(val);
908
+ }
909
+ }
910
+ });
911
+ }
912
+
913
+ var e = $('#edit-' + id + ' input.ptitle').eq(0);
914
+ var p = e.parents('label');
915
+ e.val(WPGlobusAdmin.qedit_titles[id].source);
916
+ e.addClass('hidden');
917
+ $(WPGlobusAdmin.data.template).insertAfter(p);
918
+
919
+ if ( typeof WPGlobusAdmin.qedit_titles[id] === 'undefined' ) {
920
+ WPGlobusAdmin.qedit_titles[id] = {};
921
+ WPGlobusAdmin.qedit_titles[id]['source'] = $('#'+full_id+' .name a.row-title').text();
922
+ $(WPGlobusAdmin.data.enabled_languages).each(function(i,l){
923
+ WPGlobusAdmin.qedit_titles[id][l] = {};
924
+ if ( l == WPGlobusAdmin.data.default_language ) {
925
+ WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id]['source'];
926
+ } else {
927
+ WPGlobusAdmin.qedit_titles[id][l]['name'] = '';
928
+ }
929
+ WPGlobusAdmin.qedit_titles[id][l]['description'] = '';
930
+ });
931
+ }
932
+
933
+ $( '.wpglobus-quick-edit-title' ).each(function ( i, e ) {
934
+ var $e = $(e);
935
+ var l = $e.data( 'language' );
936
+ $e.attr( 'id', l + id );
937
+ if ( typeof WPGlobusAdmin.qedit_titles[id][l] !== 'undefined' ) {
938
+ WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id][l]['name'].replace( /\\\'/g, "'" );
939
+ WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id][l]['name'].replace( /\\\"/g, '"' );
940
+ $e.attr( 'value', WPGlobusAdmin.qedit_titles[id][l]['name'] );
941
+ WPGlobusAdmin.qedit_titles[id]['source'] =
942
+ WPGlobusCore.getString(
943
+ WPGlobusAdmin.qedit_titles[id]['source'],
944
+ WPGlobusAdmin.qedit_titles[id][l]['name'],
945
+ l
946
+ );
947
+ }
948
+ });
949
+ $( 'input.ptitle' ).eq( 0 ).attr( 'value', WPGlobusAdmin.qedit_titles[ id ][ 'source' ] );
950
+ });
951
+
952
+ },
953
+ taxonomyEdit: function () {
954
+
955
+ var elements = [];
956
+ elements[0] = 'name';
957
+ elements[1] = 'description';
958
+
959
+ var make_clone = function(id,language){
960
+ var $element = $('#'+id),
961
+ clone = $element.clone(),
962
+ name = $element.attr('name'),
963
+ classes = 'wpglobus-element wpglobus-element_'+id+' wpglobus-element_'+language+' wpglobus-translatable',
964
+ node;
965
+
966
+ node = document.getElementById(id);
967
+ node = node.nodeName;
968
+ $(clone).attr('id', id+'_'+language);
969
+ $(clone).attr('name', name+'_'+language);
970
+ if ( language !== WPGlobusCoreData.default_language ) {
971
+ classes += ' hidden';
972
+ }
973
+ $(clone).attr('class', classes);
974
+ $(clone).attr('data-save-to', id);
975
+ $(clone).attr('data-language', language);
976
+ if ( node == 'INPUT' ) {
977
+ $(clone).attr('value', $('#wpglobus-link-tab-'+language).data(id));
978
+ } else if ( node == 'TEXTAREA' ) {
979
+ $(clone).text($('#wpglobus-link-tab-'+language).data(id));
980
+ }
981
+ $element.addClass('hidden');
982
+ if ( $('.wpglobus-element_'+id).length == 0 ) {
983
+ $(clone).insertAfter($element);
984
+ } else {
985
+ $(clone).insertAfter($('.wpglobus-element_'+id).last());
986
+ }
987
+ };
988
+
989
+ $.each(WPGlobusCoreData.enabled_languages, function(i,l){
990
+ $.each(elements, function(i,e){
991
+ make_clone(e,l);
992
+ });
993
+ });
994
+
995
+ $('.wpglobus-taxonomy-tabs').insertAfter('#ajax-response');
996
+
997
+ /**
998
+ * Make class wrap as tabs container.
999
+ * Tabs on.
1000
+ */
1001
+ $('.wrap').tabs();
1002
+
1003
+ $('body').on('click', '.wpglobus-taxonomy-tabs li', function(event){
1004
+ var $t = $(this);
1005
+ var language = $t.data('language');
1006
+ $('.wpglobus-element').addClass('hidden');
1007
+ $('.wpglobus-element_'+language).removeClass('hidden');
1008
+ });
1009
+
1010
+ $('.wpglobus-element').on('change', function () {
1011
+ var $this = $(this),
1012
+ save_to = $this.data('save-to'),
1013
+ s = '';
1014
+
1015
+ $('.wpglobus-element').each(function (index, element) {
1016
+ var $e = $(element),
1017
+ value = $e.val();
1018
+ if ( $e.data('save-to') == save_to && value !== '' ) {
1019
+ s = s + WPGlobusCore.addLocaleMarks(value, $e.data('language') )
1020
+ }
1021
+ });
1022
+ $('#' + save_to).val(s);
1023
+ });
1024
+
1025
+ /**
1026
+ * @since 1.8.1
1027
+ * $('<span class="wpglobus-multilingual-slug wpglobus_dialog_start wpglobus_dialog_icon" title="Title"></span>').insertBefore('#slug');
1028
+ * $('.term-slug-wrap th').css({'padding-right':'0'});
1029
+ * $('.term-slug-wrap td').css({'padding-left':'0'});
1030
+ */
1031
+ $(WPGlobusAdmin.data.multilingualSlug.title).insertAfter('.term-slug-wrap th label');
1032
+
1033
+ },
1034
+ navMenus: function () {
1035
+ var iID, menu_size,
1036
+ menu_item = '#menu-to-edit .menu-item';
1037
+
1038
+ var timer = function () {
1039
+ if ( menu_size !== $(menu_item).length ) {
1040
+ clearInterval(iID);
1041
+ $(menu_item).each(function (index, li) {
1042
+ var $li = $(li);
1043
+ if ($li.hasClass('wpglobus-menu-item')) {
1044
+ return; /** the same as continue */
1045
+ }
1046
+ var id = $(li).attr('id');
1047
+ $.each(['input.edit-menu-item-title', 'input.edit-menu-item-attr-title'], function (input_index, input) {
1048
+ var i = $('#' + id + ' ' + input);
1049
+ var $i = $(i);
1050
+ if (!$i.hasClass('wpglobus-hidden')) {
1051
+ $i.addClass('wpglobus-hidden');
1052
+ $i.css('display', 'none');
1053
+ var l = $i.parent('label');
1054
+ var p = $i.parents('p');
1055
+ $(p).css('height', '80px');
1056
+ $(l).append('<div style="color:#f00;">' + WPGlobusAdmin.i18n.save_nav_menu + '</div>');
1057
+ }
1058
+ });
1059
+ $li.addClass('wpglobus-menu-item');
1060
+ });
1061
+ }
1062
+ };
1063
+
1064
+ $.ajaxSetup({
1065
+ beforeSend: function (jqXHR, PlainObject) {
1066
+ if (typeof PlainObject.data === 'undefined') {
1067
+ return;
1068
+ }
1069
+ if (PlainObject.data.indexOf('action=add-menu-item') >= 0) {
1070
+ menu_size = $(menu_item).length;
1071
+ iID = setInterval(timer, 500);
1072
+ }
1073
+ }
1074
+ });
1075
+
1076
+ $(menu_item).each(function (index, li) {
1077
+
1078
+ var id = $(li).attr('id'),
1079
+ item_id = id.replace('menu-item-', '');
1080
+
1081
+ $.each(['input.edit-menu-item-title', 'input.edit-menu-item-attr-title'], function (input_index, input) {
1082
+ var $i = $('#' + id + ' ' + input);
1083
+ if ( $i.val() != WPGlobusAdmin.data.items[ item_id ][ input ][ 'source' ] ) {
1084
+ /**
1085
+ * fix for case when value resets by WP core
1086
+ */
1087
+ $i.val( WPGlobusAdmin.data.items[ item_id ][ input ][ 'source' ] );
1088
+ }
1089
+
1090
+ var p = $( '#' + id + ' ' + input ).parents('p');
1091
+ var height = 0;
1092
+
1093
+ $.each(WPGlobusAdmin.data.open_languages, function (index, language) {
1094
+ var new_element = $i.clone();
1095
+ new_element.attr('id', $i.attr('id') + '-' + language);
1096
+ new_element.attr('name', $i.attr('id') + '-' + language);
1097
+ new_element.attr('data-language', language);
1098
+ new_element.attr('data-item-id', item_id);
1099
+ new_element.attr('placeholder', WPGlobusAdmin.data.en_language_name[language]);
1100
+
1101
+ var classes = WPGlobusAdmin.data.items[item_id][language][input]['class'];
1102
+ if (input_index === 0 && language === WPGlobusAdmin.data.default_language) {
1103
+ new_element.attr('class', classes + ' edit-menu-item-title');
1104
+ } else {
1105
+ new_element.attr('class', classes);
1106
+ }
1107
+
1108
+ if ( WPGlobusAdmin.data.items[ item_id ][ language ][ input ][ 'caption' ] != '' ) {
1109
+ new_element.attr('value', WPGlobusAdmin.data.items[item_id][language][input]['caption']);
1110
+ } else {
1111
+ new_element.attr('value', '');
1112
+ }
1113
+ new_element.css('margin-bottom', '0.6em');
1114
+ $(p).append( new_element );
1115
+ height = index;
1116
+ });
1117
+ height = (height + 1) * 40;
1118
+ $i.css('display', 'none').attr('class', '').addClass('widefat wpglobus-hidden');
1119
+ $(p).css('height', height + 'px').addClass('wpglobus-menu-item-box');
1120
+
1121
+ });
1122
+ $(li).addClass('wpglobus-menu-item');
1123
+ });
1124
+
1125
+ $('.menus-move-left, .menus-move-right').each(function(index,e) {
1126
+ var $e = $(e), new_title;
1127
+ var item_id = $e.parents('li').attr('id').replace('menu-item-', '');
1128
+ var title = $e.attr('title');
1129
+ if ( typeof title !== 'undefined' ) {
1130
+ $.each(WPGlobusAdmin.data.post_titles, function(post_title, item_title) {
1131
+ if ( title.indexOf(post_title) >= 0 ) {
1132
+ new_title = title.replace(post_title, item_title);
1133
+ $e.attr('title', new_title);
1134
+ $e.text(new_title);
1135
+ }
1136
+ });
1137
+ }
1138
+ });
1139
+
1140
+ /**
1141
+ * Run the item handle title when the navigation label was loaded.
1142
+ * @see wp-admin\js\nav-menu.js
1143
+ */
1144
+ $('.edit-menu-item-title').trigger('change');
1145
+ wpNavMenu.refreshAdvancedAccessibility();
1146
+ wpNavMenu.menusChanged = false;
1147
+
1148
+ $('.wpglobus-menu-item').on('change', function () {
1149
+ var $this = $(this),
1150
+ item_id = $this.data('item-id'),
1151
+ s, so;
1152
+ if ($this.hasClass('wpglobus-item-title')) {
1153
+ s = WPGlobusCore.getString( $('input#edit-menu-item-title-' + item_id).val(), $this.val(), $this.data('language') );
1154
+ so = $(document).triggerHandler('wpglobus_get_menu_translations', {string:s, lang:WPGlobusCoreData.open_languages, id:item_id, type:'input.edit-menu-item-title'});
1155
+ if ( typeof so !== 'undefined' ) {
1156
+ s = so;
1157
+ }
1158
+ $('input#edit-menu-item-title-' + item_id).val(s);
1159
+ }
1160
+ if ($this.hasClass('wpglobus-item-attr')) {
1161
+ s = WPGlobusCore.getString( $('input#edit-menu-item-attr-title-' + item_id).val(), $this.val(), $this.data('language') );
1162
+ so = $(document).triggerHandler('wpglobus_get_menu_translations', {string:s, lang:WPGlobusCoreData.open_languages, id:item_id, type:'input.edit-menu-item-attr-title'});
1163
+ if ( typeof so !== 'undefined' ) {
1164
+ s = so;
1165
+ }
1166
+ $('input#edit-menu-item-attr-title-' + item_id).val(s);
1167
+ }
1168
+
1169
+ });
1170
+ },
1171
+ postEdit: function () {
1172
+ /**
1173
+ * Hook into the heartbeat-send.
1174
+ */
1175
+ $(document).on('heartbeat-send', function(e, data) {
1176
+ if ( typeof data['wp_autosave'] !== 'undefined' ) {
1177
+ data['wpglobus_heartbeat'] = 'wpglobus';
1178
+ $.each(WPGlobusAdmin.data.open_languages, function(i,l){
1179
+ var v = $('#title_'+l).val() || '';
1180
+ v = $.trim(v);
1181
+ if ( v != '' ) {
1182
+ data['wp_autosave']['post_title_'+l] = v;
1183
+ }
1184
+ v = $('#content_'+l).val() || '';
1185
+ v = $.trim(v);
1186
+ if ( v != '' ) {
1187
+ data['wp_autosave']['content_'+l] = v;
1188
+ }
1189
+ });
1190
+ }
1191
+ });
1192
+
1193
+ var wrap_at = '#postdivrich',
1194
+ set_title = true,
1195
+ content_tabs_id = '#post-body-content';
1196
+ if ( WPGlobusAdmin.data.support['editor'] === false ) {
1197
+ wrap_at = '#titlediv';
1198
+ set_title = false;
1199
+ }
1200
+ if ( WPGlobusAdmin.data.support['title'] === false ) {
1201
+ set_title = false;
1202
+ }
1203
+ /**
1204
+ * Make post-body-content as tabs container.
1205
+ */
1206
+ $(content_tabs_id).prepend($('.wpglobus-post-body-tabs-list'));
1207
+ $.each(WPGlobusAdmin.tabs, function (index, suffix) {
1208
+ if ('default' === suffix) {
1209
+ $(wrap_at).wrap('<div id="tab-default"></div>');
1210
+ if ( set_title ) {
1211
+ $($('#titlediv')).insertBefore(wrap_at);
1212
+ }
1213
+ } else {
1214
+ $(wrap_at+'-' + suffix).wrap('<div id="tab-' + suffix + '"></div>');
1215
+ if ( set_title ) {
1216
+ $($('#titlediv-' + suffix)).insertBefore(wrap_at+'-' + suffix);
1217
+ }
1218
+ }
1219
+ });
1220
+
1221
+ /**
1222
+ * Tabs on.
1223
+ */
1224
+ $(content_tabs_id).addClass('wpglobus-post-body-tabs').tabs({
1225
+ beforeActivate: function( event, ui ){
1226
+ var otab = ui.oldTab[0].id.replace('link-tab-','');
1227
+ var ntab = ui.newTab[0].id.replace('link-tab-','');
1228
+ if ( 'default' == otab ) {
1229
+ otab = WPGlobusCoreData.default_language;
1230
+ }
1231
+ if ( 'default' == ntab ) {
1232
+ ntab = WPGlobusCoreData.default_language;
1233
+ }
1234
+ var a = $(document).triggerHandler('wpglobus_post_body_tabs', [ otab, ntab ]);
1235
+ if ( a || typeof a === 'undefined' ) {
1236
+ return true;
1237
+ }
1238
+ return false;
1239
+ }
1240
+ }); /** #post-body-content */
1241
+
1242
+ /**
1243
+ * Setup for default language.
1244
+ */
1245
+ $('#title').val(WPGlobusAdmin.title);
1246
+
1247
+ /**
1248
+ * See other places with the same bookmark.
1249
+ * @bookmark EDITOR_LINE_BREAKS
1250
+ */
1251
+ //$('#content').text(WPGlobusAdmin.content.replace(/\n/g, "<p>"));
1252
+
1253
+ $('#content').text(WPGlobusAdmin.content);
1254
+
1255
+ if (typeof WPGlobusVendor !== "undefined" && WPGlobusVendor.vendor.WPSEO ) {
1256
+ if ( typeof wpglobus_wpseo !== "undefined" ) {
1257
+ wpglobus_wpseo();
1258
+ } else if ( 'undefined' !== typeof WPGlobusYoastSeo ) {
1259
+ if ( 'undefined' !== typeof WPGlobusYoastSeoPremium ) {
1260
+ /**
1261
+ * @since WPGlobus 1.7.2
1262
+ */
1263
+ if ( WPGlobusYoastSeoPremium ) {
1264
+ WPGlobusYoastSeoPremium.init();
1265
+ }
1266
+ }
1267
+ /**
1268
+ * @since Yoast SEO 3.0
1269
+ */
1270
+ WPGlobusYoastSeo.init();
1271
+ }
1272
+ }
1273
+
1274
+ if ( WPGlobusAdmin.data.modify_excerpt ) {
1275
+ /**
1276
+ * Add excerpt fields from template.
1277
+ */
1278
+ var $excerpt = $( '#excerpt' );
1279
+ $excerpt.addClass( 'hidden' ).css( {'display':'none'} );
1280
+ $( WPGlobusAdmin.data.template ).insertAfter( $excerpt );
1281
+ $( 'body' ).on( 'change', '.wpglobus-excerpt', function () {
1282
+ var $t = $( this );
1283
+ $excerpt.val( WPGlobusCore.getString( $excerpt.val(), $t.val(), $t.data('language') ) );
1284
+ });
1285
+ }
1286
+
1287
+ /**
1288
+ * wp_editor word count.
1289
+ * from WordPress 4.3 @see \wp-admin\js\post.js
1290
+ */
1291
+ if ( typeof wp.utils !== 'undefined' && typeof wp.utils.WordCounter !== 'undefined' ) {
1292
+ WPGlobusCoreData.wordCounter = {};
1293
+
1294
+ var self = this, wpglobusEditors = {};
1295
+
1296
+ $.each( WPGlobusCoreData.enabled_languages, function( i, l ){
1297
+ if ( l == WPGlobusCoreData.default_language ) {
1298
+ return true;
1299
+ }
1300
+ wpglobusEditors[i] = 'content_'+l;
1301
+
1302
+ ( function( $, counter, l ) {
1303
+ WPGlobusCoreData.wordCounter[ l ] = {};
1304
+ WPGlobusCoreData.wordCounter[ l ][ 'counter' ] = counter;
1305
+
1306
+ $( function() {
1307
+
1308
+ WPGlobusCoreData.wordCounter[ l ][ 'content' ] = $( '#content_'+l );
1309
+ WPGlobusCoreData.wordCounter[ l ][ 'count' ] = $( '#wp-word-count-'+l ).find( '.word-count-'+l );
1310
+
1311
+ WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] = 0;
1312
+
1313
+ function update( l ) {
1314
+ var text, count;
1315
+
1316
+ if ( typeof l === 'object' ) {
1317
+
1318
+ if ( l == 'tinymce' ) {
1319
+ /** wysiwyg editor */
1320
+ l = self.getCurrentTab();
1321
+ } else {
1322
+ /** textarea */
1323
+ l = l.target.id.replace( 'content_', '' );
1324
+ }
1325
+
1326
+ }
1327
+
1328
+ if ( typeof WPGlobusCoreData.wordCounter[ l ] === 'undefined' ) {
1329
+ return;
1330
+ }
1331
+
1332
+ if ( ! WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ] ||
1333
+ WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ].isHidden() ) {
1334
+
1335
+ text = WPGlobusCoreData.wordCounter[ l ][ 'content' ].val();
1336
+
1337
+ } else {
1338
+ text = WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ].getContent( { format: 'raw' } );
1339
+ }
1340
+
1341
+ count = WPGlobusCoreData.wordCounter[ l ][ 'counter' ].count( text );
1342
+
1343
+ if ( count !== WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] ) {
1344
+ WPGlobusCoreData.wordCounter[ l ][ 'count' ].text( count );
1345
+ }
1346
+
1347
+ WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] = count;
1348
+ }
1349
+
1350
+ $(document).on( 'tinymce-editor-init', function( event, editor ) {
1351
+
1352
+ if ( -1 == $.inArray(editor.id, wpglobusEditors) ) {
1353
+ /**
1354
+ * Init WPGlobus editor only.
1355
+ */
1356
+ return;
1357
+ }
1358
+ var l = editor.id.replace( 'content_', '' );
1359
+
1360
+ WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ] = editor;
1361
+
1362
+ editor.on( 'nodechange keyup', _.debounce( update, 1000 ) );
1363
+ } );
1364
+
1365
+ WPGlobusCoreData.wordCounter[l]['content'].on( 'input keyup', _.debounce( update, 1000 ) );
1366
+
1367
+ update( l );
1368
+
1369
+ } );
1370
+ } )( jQuery, new wp.utils.WordCounter(), l );
1371
+ });
1372
+
1373
+ }
1374
+
1375
+ $(document).on('click', '#publish, #save-post', function() {
1376
+ if ( WPGlobusAdmin.data.open_languages.length > 1 ) {
1377
+ $(document).triggerHandler('wpglobus_before_save_post', {content_tabs_id:content_tabs_id});
1378
+ /**
1379
+ * If empty title in default language make it from another titles.
1380
+ */
1381
+ var t = $('#title').val(),
1382
+ index, title = '', delimiter = '';
1383
+
1384
+ if ( t.length == 0 ) {
1385
+ index = WPGlobusAdmin.data.open_languages.indexOf(WPGlobusAdmin.data.default_language);
1386
+ WPGlobusAdmin.data.open_languages.splice(index, 1);
1387
+ $(WPGlobusAdmin.data.open_languages).each(function(i,l){
1388
+ delimiter = i == 0 ? '' : '-';
1389
+ t = $('#title_'+l).val();
1390
+ if ( t.length > 0 ) {
1391
+ if ( title.length == 0 ) { delimiter = '';}
1392
+ title = title + delimiter + t;
1393
+ }
1394
+ });
1395
+ }
1396
+ if ( title.length > 0 ) {
1397
+ $('#title').val(title);
1398
+ }
1399
+ }
1400
+
1401
+ /**
1402
+ * To handle taxonomy tags.
1403
+ */
1404
+ if ( 'undefined' === typeof WPGlobusAdmin.data.tagsdiv || WPGlobusAdmin.data.tagsdiv.length < 1 ) {
1405
+ return;
1406
+ }
1407
+ $(WPGlobusAdmin.data.tagsdiv).each(function(i,tagsdiv){
1408
+ if ($('#' + tagsdiv).length == 0) {
1409
+ /**
1410
+ * Next iteration.
1411
+ */
1412
+ return true;
1413
+ }
1414
+
1415
+ var id = tagsdiv.replace('tagsdiv-', '');
1416
+ if ( 'undefined' === id ) {
1417
+ return true;
1418
+ }
1419
+ if ( $('#tax-input-'+id).length == 0 ) {
1420
+ return true;
1421
+ }
1422
+
1423
+ var name, tags = [];
1424
+
1425
+ /**
1426
+ * Obsolete from WP 4.9
1427
+ * $('#tagsdiv-'+id+' .tagchecklist > span').each(function(i,e){
1428
+ */
1429
+ $('#tagsdiv-'+id+' .tagchecklist li').each(function(i,e){
1430
+ name = $(e).html();
1431
+ name = name.replace( /<button.*<\/button>&nbsp;/, '' );
1432
+ if ( 'undefined' === typeof WPGlobusAdmin.data.tag[id][name] ) {
1433
+ tags[i] = name;
1434
+ } else {
1435
+ tags[i] = WPGlobusAdmin.data.tag[id][name];
1436
+ }
1437
+ });
1438
+
1439
+ $('#tax-input-'+id).val(tags.join(', '));
1440
+ });
1441
+ /**
1442
+ * The end to handle taxonomy tags.
1443
+ */
1444
+ });
1445
+
1446
+ /**
1447
+ * The alignment when default tab was clicked.
1448
+ */
1449
+ $('.ui-state-default').on('click', function () {
1450
+ if ('link-tab-default' === $(this).attr('id')) {
1451
+ $(window).scrollTop($(window).scrollTop() + 1);
1452
+ $(window).scrollTop($(window).scrollTop() - 1);
1453
+ }
1454
+ });
1455
+
1456
+ /**
1457
+ * Set current value after language tab of content was changed.
1458
+ */
1459
+ $(document).on( 'tabsactivate', content_tabs_id, function( event, ui ) {
1460
+ WPGlobusAdmin.currentTab = ui.newTab[0].dataset.language;
1461
+ });
1462
+
1463
+ $(document).triggerHandler('wpglobus_after_post_edit');
1464
+
1465
+ },
1466
+ adminCentral: function () {
1467
+ $( '.wpglobus-admin-central-tab' ).css({ 'display':'none' });
1468
+
1469
+ if ( $( '.nav-tab-active' ).length > 1 ) {
1470
+ $( '.wpglobus-about-wrap .nav-tab-wrapper a' ).removeClass( 'nav-tab-active' );
1471
+ }
1472
+
1473
+ var setFirstElement = true;
1474
+ if ( 0 == location.hash.indexOf( '#' ) ) {
1475
+ $( '.wpglobus-about-wrap .nav-tab-wrapper a').each( function( i, e ) {
1476
+ if ( $(e).attr( 'href' ) == location.hash ) {
1477
+ setFirstElement = false;
1478
+ $(e).addClass( 'nav-tab-active' );
1479
+ }
1480
+ });
1481
+ }
1482
+ if ( setFirstElement ) {
1483
+ $( '.wpglobus-about-wrap .nav-tab-wrapper a' ).eq(0).addClass( 'nav-tab-active' );
1484
+ }
1485
+
1486
+ var activePanel = $( '.wpglobus-about-wrap .nav-tab-active' ).data( 'tab-id' );
1487
+ if ( '' != activePanel ) {
1488
+ $( '#'+activePanel ).css({'display':'block'});
1489
+ }
1490
+
1491
+ $(document).on( 'click', '.wpglobus-about-wrap .nav-tab', function(event){
1492
+ var $t = $( this );
1493
+ if ( $t.hasClass( 'nav-tab-active' ) ) {
1494
+ return;
1495
+ }
1496
+ $( '.wpglobus-admin-central-tab' ).css({ 'display':'none' });
1497
+ $( '.wpglobus-about-wrap .nav-tab' ).removeClass( 'nav-tab-active' );
1498
+ $t.addClass( 'nav-tab-active' );
1499
+ if ( '' != $t.data( 'tab-id' ) ) {
1500
+ $( '#' + $t.data( 'tab-id' ) ).css({ 'display':'block' });
1501
+ }
1502
+ });
1503
+ },
1504
+ start: function () {
1505
+ var t = this;
1506
+ $('#wpglobus_flags').select2({
1507
+ formatResult: this.format,
1508
+ formatSelection: this.format,
1509
+ minimumResultsForSearch: -1,
1510
+ escapeMarkup: function (m) {
1511
+ return m;
1512
+ }
1513
+ });
1514
+
1515
+ /** disable checked off first language */
1516
+ $('body').on('click', '#enabled_languages-list li:first input', function (event) {
1517
+ event.preventDefault();
1518
+ $('.redux-save-warn').css({'display': 'none'});
1519
+ $('#enabled_languages-list').find('li:first > input').val('1');
1520
+ if ($('#disable_first_language').length === 0) {
1521
+ $(t.config.disable_first_language).insertAfter('#info_bar');
1522
+ }
1523
+ return false;
1524
+ });
1525
+
1526
+ },
1527
+ format: function (language) {
1528
+ return '<img class="wpglobus_flag" src="' + WPGlobusAdmin.flag_url + language.text + '"/>&nbsp;&nbsp;' + language.text;
1529
+ },
1530
+ set_dialog: function() {
1531
+
1532
+ if ( 'undefined' !== typeof WPGlobusAdmin.data.customFieldsEnabled ) {
1533
+ WPGlobusAdmin.data.customFieldsEnabled = this.parseBool( WPGlobusAdmin.data.customFieldsEnabled );
1534
+ if ( ! WPGlobusAdmin.data.customFieldsEnabled ) {
1535
+ return;
1536
+ }
1537
+ }
1538
+
1539
+ var ajaxify_row_id, added_control = false;
1540
+ var add_elements = function(post_id) {
1541
+
1542
+ var id, rows, cb, _cb,
1543
+ _classes = 'wpglobus_dialog_start wpglobus_dialog_icon';
1544
+
1545
+ _cb = [
1546
+ '<div class="wpglobus_dialog_options_wrapper hidden">',
1547
+ '<input style="width:initial;" id="wpglobus-cb-{{id}}" data-object="#wpglobus-dialog-start-{{id}}" data-meta-key="{{meta-key}}" class="wpglobus_dialog_option wpglobus_dialog_cb" type="checkbox" {{checked}} />',
1548
+ '</div>'
1549
+ ].join('');
1550
+
1551
+ if (typeof post_id == 'undefined') {
1552
+ rows = '#the-list tr';
1553
+ } else {
1554
+ rows = '#the-list tr#'+post_id;
1555
+ }
1556
+ $(rows).each(function(){
1557
+ var $t = $(this),
1558
+ tid = $t.attr('id'),
1559
+ element = $t.find('textarea'),
1560
+ clone, name, meta_key,
1561
+ classes = _classes;
1562
+
1563
+ id = element.attr('id');
1564
+ if ( undefined === id ) {
1565
+ return true;
1566
+ }
1567
+ meta_key = $('#'+tid+'-key').val();
1568
+ clone = $('#'+id).clone();
1569
+ $(element).addClass('wpglobus-dialog-field-source hidden');
1570
+ name = element.attr('name');
1571
+ $(clone).attr('id', 'wpglobus-'+id);
1572
+ $(clone).attr('name', 'wpglobus-'+name);
1573
+ $(clone).attr('data-source-id', id);
1574
+ $(clone).attr('class', 'wpglobus-dialog-field');
1575
+ $(clone).val( WPGlobusCore.TextFilter($(element).val(), WPGlobusCoreData.language) );
1576
+ $(clone).insertAfter(element);
1577
+ cb = _cb.replace(/{{id}}/g, id);
1578
+ cb = cb.replace(/{{meta-key}}/g, meta_key);
1579
+ if ( undefined === WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type] ) {
1580
+ cb = cb.replace(/{{checked}}/, 'checked');
1581
+ } else {
1582
+ if ( undefined !== WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][meta_key] && WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][meta_key] == 'false' ) {
1583
+ cb = cb.replace(/{{checked}}/, '');
1584
+ classes = _classes+' wpglobus_dialog_start_hidden';
1585
+ } else {
1586
+ cb = cb.replace(/{{checked}}/, 'checked');
1587
+ classes = _classes;
1588
+ }
1589
+ }
1590
+ $t.append('<td style="width:20px;"><div id="wpglobus-dialog-start-'+id+'" data-type="control" data-source-type="textarea" data-source-id="'+id+'" class="'+classes+'"></div>'+cb+'</td>');
1591
+ });
1592
+ if ( ! added_control && $('#list-table .wpglobus_dialog_start').length > 0 ) {
1593
+ $('#list-table thead tr').append('<th class="wpglobus-control-head"><div class="wpglobus_dialog_settings wpglobus_dialog_icon"></div></th>');
1594
+ added_control = true;
1595
+ }
1596
+ }
1597
+
1598
+ add_elements();
1599
+
1600
+ $('body').on('change', '.wpglobus-dialog-field', function(){
1601
+ var $t = $(this),
1602
+ source_id = '#'+$t.data('source-id'),
1603
+ source = '', s = '', new_value;
1604
+
1605
+ if ( typeof source_id == 'undefined' ) {
1606
+ return;
1607
+ }
1608
+ source = $(source_id).val();
1609
+
1610
+ if ( ! /(\{:|\[:|<!--:)[a-z]{2}/.test(source) ) {
1611
+ $(source_id).val($t.val());
1612
+ } else {
1613
+ $.each(WPGlobusCoreData.enabled_languages, function(i,l){
1614
+ if ( l == WPGlobusCoreData.language ) {
1615
+ new_value = $t.val();
1616
+ } else {
1617
+ new_value = WPGlobusCore.TextFilter(source,l,'RETURN_EMPTY');
1618
+ }
1619
+ if ( '' != new_value ) {
1620
+ s = s + WPGlobusCore.addLocaleMarks(new_value,l);
1621
+ }
1622
+ });
1623
+ $(source_id).val(s);
1624
+ }
1625
+
1626
+ });
1627
+
1628
+ $(document).ajaxSend(function(event, jqxhr, settings){
1629
+ if ( 'add-meta' == settings.action ) {
1630
+ ajaxify_row_id = settings.element;
1631
+ }
1632
+ });
1633
+ $(document).ajaxComplete(function(event, jqxhr, settings){
1634
+ if ( 'add-meta' == settings.action && undefined !== jqxhr.responseXML ) {
1635
+ if ( 'newmeta' == ajaxify_row_id ) {
1636
+ add_elements('meta-'+$(jqxhr.responseXML.documentElement.outerHTML).find('meta').attr('id'));
1637
+ } else {
1638
+ add_elements(ajaxify_row_id);
1639
+ }
1640
+ }
1641
+ });
1642
+
1643
+ WPGlobusDialogApp.init({dialogTitle:'Edit meta'});
1644
+
1645
+ }
1646
+ };
1647
+
1648
+ new WPGlobusAdminApp.App();
1649
+
1650
+ return WPGlobusAdminApp;
1651
+
1652
+ }(window.WPGlobusAdminApp || {}, jQuery));
1653
+
1654
+ });
includes/js/wpglobus-admin-49.min.js CHANGED
@@ -1 +1 @@
1
- var WPGlobusCore;!function(t){var a;a=WPGlobusCore={strpos:function(t,a,e){var o=(t=""+t).indexOf(a,e);return o>=0&&o},TextFilter:function(t,e,o){if(void 0===t||""===t)return t;var n,i,l=[],s=!1;e=""==e?"en":e,o=void 0===o||""==o?"RETURN_IN_DEFAULT_LANGUAGE":o,l[0]=[],l[0].start=WPGlobusCoreData.locale_tag_start.replace("%s",e),l[0].end=WPGlobusCoreData.locale_tag_end,l[1]=[],l[1].start="\x3c!--:"+e+"--\x3e",l[1].end="\x3c!--:--\x3e",l[2]=[],l[2].start="[:"+e+"]",l[2].end="[:";for(var d=0;d<3;d++)if(!1!==(n=a.strpos(t,l[d].start))){n+=l[d].start.length,t=!1===(i=a.strpos(t,l[d].end,n))?t.substr(n):t.substr(n,i-n),s=!0;break}return s||("RETURN_EMPTY"==o?(e!=WPGlobusCoreData.default_language||/(\{:|\[:|<!--:)[a-z]{2}/.test(t))&&(t=""):e==WPGlobusCoreData.default_language?/(\{:|\[:|<!--:)[a-z]{2}/.test(t)&&(t=""):t=a.TextFilter(t,WPGlobusCoreData.default_language)),t},addLocaleMarks:function(t,a){return WPGlobusCoreData.locale_tag_start.replace("%s",a)+t+WPGlobusCoreData.locale_tag_end},getTranslations:function(e){var o,n={};return t.each(WPGlobusCoreData.enabled_languages,function(t,i){o=i==WPGlobusCoreData.default_language?"RETURN_IN_DEFAULT_LANGUAGE":"RETURN_EMPTY",n[i]=a.TextFilter(e,i,o)}),n},getString:function(e,o,n){if(void 0===e)return e;void 0===o&&(o=""),void 0===n&&(n=WPGlobusCoreData.language),(e=a.getTranslations(e))[n]=o;var i="";return t.each(e,function(t,e){""!=e&&t!=WPGlobusCoreData.default_language&&(i+=a.addLocaleMarks(e,t))}),""!=e[WPGlobusCoreData.default_language]&&(i=""==i?e[WPGlobusCoreData.default_language]:a.addLocaleMarks(e[WPGlobusCoreData.default_language],WPGlobusCoreData.default_language)+i),i}}}(jQuery);var WPGlobusDialogApp;!function(t){var a;a=WPGlobusDialogApp={option:{listenClass:".wpglobus_dialog_start",settingsClass:".wpglobus_dialog_settings",dialogTabs:"#wpglobus-dialog-tabs",dialogTitle:"",customData:null,callback:function(){},dialogOptions:{title:"",placeholder:"",formFooter:"",beforeOpen:function(){},close:function(){}},dialog:{}},form:void 0,element:void 0,element_by:"id",id:"",clone_id:"",wpglobus_id:"",type:"textarea",source:"",order:{},value:{},request:"core",attrs:{},dialogTitle:"",trClass:"wpglobus-translatable",startButton:['<span id="wpglobus-dialog-start-{{clone_id}}" ','style="{{style}}" ','data-type="control" data-dialog-title="{{title}}" ','data-source-type="" data-source-id="{{id}}" data-source-name="{{name}}" ','data-nodename="{{nodename}}"',"{{sbTitle}} ",'class="{{classes}}"></span>'].join(""),startButtonClass:"wpglobus_dialog_start wpglobus_dialog_icon",clicks:0,init:function(e){a.option.dialog=a.option.dialogOptions,a.option=t.extend(a.option,e),t(a.option.dialogTabs).tabs(),a.dialogTitle=a.option.dialogTitle,this.attachListener(),null!=a.option.customData&&void 0!==a.option.customData.addElements&&t.each(a.option.customData.addElements,function(t,e){a.addElement(e)})},convertToId:function(t){return t=(t=t.replace(/\]/g,"")).replace(/\[/g,"-")},addElement:function(e){var o={id:null,style:"",styleTextareaWrapper:"",sbTitle:"",onChangeClass:"",dialogTitle:"",dialog:a.option.dialogOptions};if("string"==typeof e)o.id=e;else{if("object"!=typeof e)return;o=t.extend(o,e)}var n,i,l,s=null,d=null,u=null,r=null,c=a.startButton,g="";if(a.element_by="name",0==(r=document.getElementsByName(o.id)).length&&(a.element_by="id",r=document.getElementById(o.id)),null!==r){if(d=o.id,"id"==a.element_by?s=t("#"+d):(g=(g=r[0].nodeName).toLowerCase(),s=t(g+'[name="'+d+'"]')),u=void 0===s.attr("name")||""==s.attr("name")?d:s.attr("name"),a.clone_id=a.convertToId(d),-1!=u.indexOf("wpglobus")||-1!=a.clone_id.indexOf("wpglobus"))return!1;if(t("#wpglobus-"+a.clone_id).length>0)return!1;if(t(g+'[name="wpglobus-'+u+'"]').length>0)return!1;n=t(s.clone()),l=s.attr("style")||"",s.attr("style","display:none;"),n.attr("id","wpglobus-"+a.clone_id).attr("name","wpglobus-"+u),n.addClass(a.trClass),""!=o.onChangeClass&&n.addClass(o.onChangeClass),"id"==a.element_by?n.attr("data-source-id",d).attr("data-source-name","").attr("data-source-get-by",a.element_by):n.attr("data-source-id","").attr("data-source-name",u).attr("data-source-get-by",a.element_by),"textarea"==g?(i=WPGlobusCore.getTranslations(s.val())[WPGlobusCoreData.language],n.val(i),n.attr("data-nodename","textarea"),""==o.style?n.attr("style",l+";width:95%;float:left;"):n.attr("style",l+";"+o.style)):(i=WPGlobusCore.getTranslations(s.val())[WPGlobusCoreData.language],n.attr("value",i),n.attr("data-nodename","input"),""!=o.style&&n.attr("style",l+";"+o.style)),""!=o.dialog&&n.attr("data-dialog",JSON.stringify(o.dialog)),c=c.replace(/{{clone_id}}/g,a.clone_id),c="id"==a.element_by?(c=(c=c.replace(/{{id}}/g,a.clone_id)).replace(/{{name}}/g,"")).replace(/{{nodename}}/g,""):(c=(c=c.replace(/{{id}}/g,"")).replace(/{{name}}/g,u)).replace(/{{nodename}}/g,g),c="textarea"==g?c.replace("{{style}}","float:left;margin-top:0;"):c.replace("{{style}}","");var b="textarea"==g?a.startButtonClass+" wpglobus-textarea wpglobus-textarea-"+a.clone_id:a.startButtonClass;c=c.replace("{{classes}}",b),c=""==o.dialogTitle?c.replace("{{title}}",a.dialogTitle):c.replace("{{title}}",o.dialogTitle),c=""==o.sbTitle?c.replace("{{sbTitle}}",o.sbTitle):c.replace("{{sbTitle}}",'title="'+o.sbTitle+'"'),t(c).insertAfter(s),t(n).insertAfter(s),"textarea"==g&&(t("#wpglobus-"+a.clone_id).addClass("wpglobus-textarea-"+a.clone_id),t(".wpglobus-textarea-"+a.clone_id).wrapAll('<div class="wpglobus-textarea-wrapper" style="'+o.styleTextareaWrapper+'"></div>'));var p,m=!1;if(""==o.onChangeClass)p="#wpglobus-"+a.clone_id;else{p="."+o.onChangeClass;var v=t._data(t(document)[0],"events");void 0===v?m=!0:void 0!==v.change&&t.each(v.change,function(t,a){if(a.selector==p)return m=!0,!1})}return!!m||(t(document).on("change",p,function(){var a=t(this),e=a.data("source-id");e=""==e?a.data("nodename")+'[name="'+a.data("source-name")+'"]':"#"+e,t(e).val(WPGlobusCore.getString(t(e).val(),a.val()))}),!0)}},saveDialog:function(){var e,o,n,i="",l="",s="";t(".wpglobus_dialog_textarea").each(function(a,d){e=t(d),o=e.val(),(n=e.data("language"))==WPGlobusAdmin.data.language&&(s=o),""!=o&&(i+=WPGlobusCore.addLocaleMarks(o,n),n==WPGlobusCoreData.default_language&&(l=o))}),i=i.length==l.length+8?l:i,t(a.id).val(i),i=""==s?l:s,t(a.wpglobus_id).val(i)},dialog:t("#wpglobus-dialog-wrapper").dialog({autoOpen:!1,width:650,modal:!0,dialogClass:"wpglobus-dialog",buttons:[{text:"Save",class:"wpglobus-button-save",click:function(){a.saveDialog(),a.dialog.dialog("close")}},{text:"Cancel",class:"wpglobus-button-cancel",click:function(){a.dialog.dialog("close")}}],open:function(e,o){var n=a.dialogTitle;void 0!==a.attrs.maxlength&&(t(".wpglobus_dialog_textarea").attr("maxlength",a.attrs.maxlength),n+=" | maxlength="+a.attrs.maxlength),t(".wpglobus-dialog .ui-dialog-title").text(n)},close:function(){a.runCallback(a.option.dialog.close),a.form[0].reset()}}),attachListener:function(){t(document).on("click",a.option.settingsClass,function(){t(".wpglobus_dialog_options_wrapper").hasClass("hidden")?t(".wpglobus_dialog_options_wrapper").removeClass("hidden"):t(".wpglobus_dialog_options_wrapper").addClass("hidden")}),t(document).on("click",".wpglobus_dialog_option",function(e){var o=t(this),n=o.data("object");a.order.action="save_post_meta_settings",a.order.post_type=WPGlobusAdmin.data.post_type,a.order.checked=o.prop("checked"),a.order.id=o.attr("id"),a.order.meta_key=o.data("meta-key"),a.ajax(a.order).done(function(a){"ok"==a.result&&("true"==a.checked?t(n).removeClass("wpglobus_dialog_start_hidden"):t(n).addClass("wpglobus_dialog_start_hidden"))}).fail(function(t){}).always(function(t,a){})}),t(document).on("click",a.option.listenClass,function(e){a.element=t(this),a.id=a.element.data("source-id"),""==a.id?(a.id=a.element.data("nodename")+'[name="'+a.element.data("source-name")+'"]',a.wpglobus_id="#wpglobus-"+a.convertToId(a.element.data("source-name"))):(a.wpglobus_id="#wpglobus-"+a.id,a.id="#"+a.id),a.clicks++,1==a.clicks&&setTimeout(function(){if(1==a.clicks)a.onClick(e);else{var o=t(a.id);o.hasClass("hidden")?o.removeClass("hidden").attr("style","display:block;"):o.addClass("hidden").attr("style","display:none;")}a.clicks=0},200)}),a.form=a.dialog.find("form#wpglobus-dialog-form").on("submit",function(t){t.preventDefault(),a.saveDialog()})},ajax:function(a){return t.ajax({type:"POST",url:WPGlobusAdmin.ajaxurl,data:{action:WPGlobusAdmin.process_ajax,order:a},dataType:"json",async:!1})},onClick:function(e){void 0===a.element.data("dialog-title")||""==a.element.data("dialog-title")?a.dialogTitle=a.option.dialogTitle:a.dialogTitle=a.element.data("dialog-title"),void 0!==a.id&&(a.attrs.maxlength=t(a.id).attr("maxlength")),a.source=a.element.data("source-value"),void 0===a.source&&(a.source=t(a.id).val(),"ajax"==a.request||(a.value=WPGlobusCore.getTranslations(a.source))),a.option.dialog=t.extend({},a.option.dialogOptions,t(a.wpglobus_id).data("dialog")),""!=a.option.dialog.title&&(a.dialogTitle=a.option.dialog.title),t.each(a.value,function(e,o){var n=t("#wpglobus-dialog-"+e);n.val(o),n.attr("placeholder",WPGlobusCore.TextFilter(a.option.dialog.placeholder,e,"RETURN_IN_DEFAULT_LANGUAGE"))}),t("#wpglobus-dialog-form-footer").html(a.option.dialog.formFooter),a.runCallback(a.option.dialog.beforeOpen),a.dialog.dialog("open")},runCallback:function(t){if("object"==typeof t){var a=Object.keys(t)[0],e=t[Object.keys(t)[0]];"window"===a?"function"==typeof window[e]&&window[e](t[Object.keys(t)[1]]):"function"==typeof window[a][e]&&window[a][e](t[Object.keys(t)[1]])}else"string"==typeof t&&"function"==typeof window[t]&&window[t]()}}}(jQuery),jQuery(document).ready(function(){"use strict";window.WPGlobusAdminApp=(t=window.WPGlobusAdminApp||{},a=jQuery,t.App=function(t){void 0===window.WPGlobusAdminApp&&(this.config={debug:!1,version:WPGlobusAdmin.version},this.status="ok","undefined"==typeof WPGlobusAdmin?(this.status="error",this.config.debug&&console.log("WPGlobus: error options loading")):this.config.debug&&console.dir(WPGlobusAdmin),this.config.disable_first_language=['<div id="disable_first_language" style="display:block;" class="redux-field-errors notice-red">',"<strong>","<span>&nbsp;</span>",WPGlobusAdmin.i18n.cannot_disable_language,"</strong>","</div>"].join(""),a.extend(this.config,t),"ok"===this.status&&this.init())},t.App.prototype={$document:a(document),init:function(){WPGlobusCoreData.multisite=this.parseBool(WPGlobusCoreData.multisite),this.adminInit(),a("#content").addClass("wpglobus-editor").attr("data-language",WPGlobusAdmin.data.default_language),a("textarea[id^=content_]").each(function(t,e){var o=a(e).attr("id").replace("content_","");a(e).attr("data-language",o)}),"post.php"===WPGlobusAdmin.page?(this.postEdit(),this.set_dialog(),"undefined"!=typeof WPGlobusAioseop&&WPGlobusAioseop.init()):"menu-edit"===WPGlobusAdmin.page?this.navMenus():"taxonomy-edit"===WPGlobusAdmin.page?WPGlobusAdmin.data.tag_id&&this.taxonomyEdit():"taxonomy-quick-edit"===WPGlobusAdmin.page?this.quickEdit("taxonomy"):"edit.php"===WPGlobusAdmin.page?this.quickEdit("post"):"options-general.php"==WPGlobusAdmin.page?(this.optionsGeneral(),WPGlobusDialogApp.init({customData:WPGlobusCoreData.page_custom_data})):"widgets.php"==WPGlobusAdmin.page?(WPGlobusWidgets.init(),WPGlobusDialogApp.init({dialogTitle:"Edit text"})):"wpglobus_options"==WPGlobusAdmin.page?this.start():"wpglobusAdminCentral"==WPGlobusAdmin.page?this.adminCentral():WPGlobusDialogApp.init({customData:WPGlobusCoreData.page_custom_data})},parseBool:function(t){return!/^(false|0)$/i.test(t)&&!!t},getCurrentTab:function(){return a(".wpglobus-post-body-tabs-list .ui-tabs-active").data("language")},adminInit:function(){var t=a(".wpglobus-addons-group a").data("key");if(void 0!==t)if(window.location.search.indexOf("page=wpglobus_options&tab="+t)>=0)WPGlobusCoreData.multisite?window.location=WPGlobusCoreData.pluginInstallLocation.multisite:window.location=WPGlobusCoreData.pluginInstallLocation.single;else{var e=a("#toplevel_page_wpglobus_options li").eq(t+1);WPGlobusCoreData.multisite?a(e).find("a").attr("href",WPGlobusCoreData.pluginInstallLocation.multisite).attr("onclick","window.location=jQuery(this).attr('href');return false;"):a(e).find("a").attr("href",WPGlobusCoreData.pluginInstallLocation.single).attr("onclick","window.location=jQuery(this).attr('href');return false;")}},optionsGeneral:function(){var t=a("#blogname"),e=a("body");t.addClass("hidden"),a("#wpglobus-blogname").insertAfter(t).removeClass("hidden"),e.on("blur",".wpglobus-blogname",function(){a(".wpglobus-blogname").each(function(e,o){var n=a(o);t.val(WPGlobusCore.getString(t.val(),n.val(),n.data("language")))})});var o=a("#blogdescription");o.addClass("hidden"),a("#wpglobus-blogdescription").insertAfter(o).removeClass("hidden"),e.on("blur",".wpglobus-blogdesc",function(){a(".wpglobus-blogdesc").each(function(t,e){var n=a(e);o.val(WPGlobusCore.getString(o.val(),n.val(),n.data("language")))})})},quickEdit:function(t){if(void 0!==WPGlobusAdmin.data.has_items&&WPGlobusAdmin.data.has_items){var e="",o=0;a(document).ajaxComplete(function(t,n,i){void 0!==i.data&&""!=e&&i.data.indexOf("action=inline-save-tax&")>=0&&(a("#"+e+" a.row-title").text(WPGlobusAdmin.qedit_titles[o][WPGlobusAdmin.data.language].name),a("#"+e+" .description").text(WPGlobusAdmin.qedit_titles[o][WPGlobusAdmin.data.language].description))});var n={};a("#the-list tr").each(function(e,i){var l=a(i),s="post"===t?"post-":"tag-";o=l.attr("id").replace(s,""),n[o]={},"post"===t?n[o].source=l.find(".post_title").text():"taxonomy"===t&&(n[o].source=a("#inline_"+o+" .name").text())});var i={};i.action="get_titles",i.type=t,i.taxonomy=void 0!==WPGlobusAdmin.data.taxonomy&&WPGlobusAdmin.data.taxonomy,i.title=n,a.ajax({type:"POST",url:WPGlobusAdmin.ajaxurl,data:{action:WPGlobusAdmin.process_ajax,order:i},dataType:"json"}).done(function(t){WPGlobusAdmin.qedit_titles=t.qedit_titles,a.each(t.bulkedit_post_titles,function(t,e){a("#inline_"+t+" .post_title").text(e[WPGlobusAdmin.data.language].name)})}).fail(function(t){}).always(function(t,a){}),a("body").on("change",".wpglobus-quick-edit-title",function(){var t="",e=[];a(".wpglobus-quick-edit-title").each(function(n,i){var l=a(i),s=l.data("language");""!==l.val()&&(t=WPGlobusCore.getString(t,l.val(),s)),WPGlobusAdmin.qedit_titles[o][s].name=l.val(),e[n]=s});var n=a(document).triggerHandler("wpglobus_get_translations",{string:t,lang:e,id:o});void 0!==n&&(t=n),a("input.ptitle").eq(0).attr("value",t),WPGlobusAdmin.qedit_titles[o].source=t}),void 0!==WPGlobusAdmin.data.tags&&a.each(WPGlobusAdmin.data.tags,function(t,a){WPGlobusAdmin.data.value[a].post_id={}}),a("button.save, input#bulk_edit").on("mouseenter",function(t){void 0!==WPGlobusAdmin.data.tags&&("bulk_edit"==t.currentTarget.id?a("input#bulk_edit").unbind("click"):a("button.save").unbind("click"),a("button.save, input#bulk_edit").on("click",function(t){var e=a.when(),n=(a(this),a.Deferred());n.resolve(function(e){e.next(".spinner").css({visibility:"visible"}),"bulk_edit"!=t.currentTarget.id&&a.ajaxSetup({async:!1});var o,n,i,l=e.parents("tr"),s=l.attr("id").replace("edit-","");a.each(WPGlobusAdmin.data.tags,function(t,a){if(0==(o=l.find("textarea[name='"+WPGlobusAdmin.data.names[a]+"']")).length)return!0;WPGlobusAdmin.data.value[a].post_id[s]=o.val(),n=WPGlobusAdmin.data.value[a].post_id[s].split(","),i=[];for(var e=0;e<n.length;e++)n[e]=n[e].trim(" "),""!=n[e]&&(void 0===WPGlobusAdmin.data.tag[a][n[e]]?i[e]=n[e]:i[e]=WPGlobusAdmin.data.tag[a][n[e]]);o.val(i.join(", "))})}(a(this))),e=e.then(function(){return a.when(n.done())}).then(function(){"bulk_edit"!=t.currentTarget.id&&setTimeout(function(){inlineEditPost.save(o),a.ajaxSetup({async:!0})},50)})}))}),a("#the-list").on("click","a.editinline",function(){var n=a(this);if(e=n.parents("tr").attr("id"),"post"===t)o=e.replace("post-","");else{if("taxonomy"!==t)return;o=e.replace("tag-","")}"post"===t&&void 0!==WPGlobusAdmin.data.tags&&a.each(WPGlobusAdmin.data.tags,function(t,e){if(""!=WPGlobusAdmin.data.value[e]){var n,i=a("#edit-"+o+' textarea[name="'+WPGlobusAdmin.data.names[e]+'"]').val();void 0!==i&&(n=i.split(","),a.each(n,function(t,a){i=i.replace(a,WPGlobusCore.TextFilter(a,WPGlobusCoreData.language))}),a("#edit-"+o+' textarea[name="'+WPGlobusAdmin.data.names[e]+'"]').val(i))}});var i=a("#edit-"+o+" input.ptitle").eq(0),l=i.parents("label");i.val(WPGlobusAdmin.qedit_titles[o].source),i.addClass("hidden"),a(WPGlobusAdmin.data.template).insertAfter(l),void 0===WPGlobusAdmin.qedit_titles[o]&&(WPGlobusAdmin.qedit_titles[o]={},WPGlobusAdmin.qedit_titles[o].source=a("#"+e+" .name a.row-title").text(),a(WPGlobusAdmin.data.enabled_languages).each(function(t,a){WPGlobusAdmin.qedit_titles[o][a]={},a==WPGlobusAdmin.data.default_language?WPGlobusAdmin.qedit_titles[o][a].name=WPGlobusAdmin.qedit_titles[o].source:WPGlobusAdmin.qedit_titles[o][a].name="",WPGlobusAdmin.qedit_titles[o][a].description=""})),a(".wpglobus-quick-edit-title").each(function(t,e){var n=a(e),i=n.data("language");n.attr("id",i+o),void 0!==WPGlobusAdmin.qedit_titles[o][i]&&(WPGlobusAdmin.qedit_titles[o][i].name=WPGlobusAdmin.qedit_titles[o][i].name.replace(/\\\'/g,"'"),WPGlobusAdmin.qedit_titles[o][i].name=WPGlobusAdmin.qedit_titles[o][i].name.replace(/\\\"/g,'"'),n.attr("value",WPGlobusAdmin.qedit_titles[o][i].name),WPGlobusAdmin.qedit_titles[o].source=WPGlobusCore.getString(WPGlobusAdmin.qedit_titles[o].source,WPGlobusAdmin.qedit_titles[o][i].name,i))}),a("input.ptitle").eq(0).attr("value",WPGlobusAdmin.qedit_titles[o].source)})}},taxonomyEdit:function(){var t=[];t[0]="name",t[1]="description",a.each(WPGlobusCoreData.enabled_languages,function(e,o){a.each(t,function(t,e){!function(t,e){var o,n=a("#"+t),i=n.clone(),l=n.attr("name"),s="wpglobus-element wpglobus-element_"+t+" wpglobus-element_"+e+" wpglobus-translatable";o=(o=document.getElementById(t)).nodeName,a(i).attr("id",t+"_"+e),a(i).attr("name",l+"_"+e),e!==WPGlobusCoreData.default_language&&(s+=" hidden"),a(i).attr("class",s),a(i).attr("data-save-to",t),a(i).attr("data-language",e),"INPUT"==o?a(i).attr("value",a("#wpglobus-link-tab-"+e).data(t)):"TEXTAREA"==o&&a(i).text(a("#wpglobus-link-tab-"+e).data(t)),n.addClass("hidden"),0==a(".wpglobus-element_"+t).length?a(i).insertAfter(n):a(i).insertAfter(a(".wpglobus-element_"+t).last())}(e,o)})}),a(".wpglobus-taxonomy-tabs").insertAfter("#ajax-response"),a(".wrap").tabs(),a("body").on("click",".wpglobus-taxonomy-tabs li",function(t){var e=a(this).data("language");a(".wpglobus-element").addClass("hidden"),a(".wpglobus-element_"+e).removeClass("hidden")}),a(".wpglobus-element").on("change",function(){var t=a(this).data("save-to"),e="";a(".wpglobus-element").each(function(o,n){var i=a(n),l=i.val();i.data("save-to")==t&&""!==l&&(e+=WPGlobusCore.addLocaleMarks(l,i.data("language")))}),a("#"+t).val(e)}),a(WPGlobusAdmin.data.multilingualSlug.title).insertAfter(".term-slug-wrap th label")},navMenus:function(){var t,e,o="#menu-to-edit .menu-item",n=function(){e!==a(o).length&&(clearInterval(t),a(o).each(function(t,e){var o=a(e);if(!o.hasClass("wpglobus-menu-item")){var n=a(e).attr("id");a.each(["input.edit-menu-item-title","input.edit-menu-item-attr-title"],function(t,e){var o=a("#"+n+" "+e),i=a(o);if(!i.hasClass("wpglobus-hidden")){i.addClass("wpglobus-hidden"),i.css("display","none");var l=i.parent("label"),s=i.parents("p");a(s).css("height","80px"),a(l).append('<div style="color:#f00;">'+WPGlobusAdmin.i18n.save_nav_menu+"</div>")}}),o.addClass("wpglobus-menu-item")}}))};a.ajaxSetup({beforeSend:function(i,l){void 0!==l.data&&l.data.indexOf("action=add-menu-item")>=0&&(e=a(o).length,t=setInterval(n,500))}}),a(o).each(function(t,e){var o=a(e).attr("id"),n=o.replace("menu-item-","");a.each(["input.edit-menu-item-title","input.edit-menu-item-attr-title"],function(t,e){var i=a("#"+o+" "+e);i.val()!=WPGlobusAdmin.data.items[n][e].source&&i.val(WPGlobusAdmin.data.items[n][e].source);var l=a("#"+o+" "+e).parents("p"),s=0;a.each(WPGlobusAdmin.data.open_languages,function(o,d){var u=i.clone();u.attr("id",i.attr("id")+"-"+d),u.attr("name",i.attr("id")+"-"+d),u.attr("data-language",d),u.attr("data-item-id",n),u.attr("placeholder",WPGlobusAdmin.data.en_language_name[d]);var r=WPGlobusAdmin.data.items[n][d][e].class;0===t&&d===WPGlobusAdmin.data.default_language?u.attr("class",r+" edit-menu-item-title"):u.attr("class",r),""!=WPGlobusAdmin.data.items[n][d][e].caption?u.attr("value",WPGlobusAdmin.data.items[n][d][e].caption):u.attr("value",""),u.css("margin-bottom","0.6em"),a(l).append(u),s=o}),s=40*(s+1),i.css("display","none").attr("class","").addClass("widefat wpglobus-hidden"),a(l).css("height",s+"px").addClass("wpglobus-menu-item-box")}),a(e).addClass("wpglobus-menu-item")}),a(".menus-move-left, .menus-move-right").each(function(t,e){var o,n=a(e),i=(n.parents("li").attr("id").replace("menu-item-",""),n.attr("title"));void 0!==i&&a.each(WPGlobusAdmin.data.post_titles,function(t,a){i.indexOf(t)>=0&&(o=i.replace(t,a),n.attr("title",o),n.text(o))})}),a(".edit-menu-item-title").trigger("change"),wpNavMenu.refreshAdvancedAccessibility(),wpNavMenu.menusChanged=!1,a(".wpglobus-menu-item").on("change",function(){var t,e,o=a(this),n=o.data("item-id");o.hasClass("wpglobus-item-title")&&(t=WPGlobusCore.getString(a("input#edit-menu-item-title-"+n).val(),o.val(),o.data("language")),void 0!==(e=a(document).triggerHandler("wpglobus_get_menu_translations",{string:t,lang:WPGlobusCoreData.open_languages,id:n,type:"input.edit-menu-item-title"}))&&(t=e),a("input#edit-menu-item-title-"+n).val(t)),o.hasClass("wpglobus-item-attr")&&(t=WPGlobusCore.getString(a("input#edit-menu-item-attr-title-"+n).val(),o.val(),o.data("language")),void 0!==(e=a(document).triggerHandler("wpglobus_get_menu_translations",{string:t,lang:WPGlobusCoreData.open_languages,id:n,type:"input.edit-menu-item-attr-title"}))&&(t=e),a("input#edit-menu-item-attr-title-"+n).val(t))})},postEdit:function(){a(document).on("heartbeat-send",function(t,e){void 0!==e.wp_autosave&&(e.wpglobus_heartbeat="wpglobus",a.each(WPGlobusAdmin.data.open_languages,function(t,o){var n=a("#title_"+o).val()||"";""!=(n=a.trim(n))&&(e.wp_autosave["post_title_"+o]=n),n=a("#content_"+o).val()||"",""!=(n=a.trim(n))&&(e.wp_autosave["content_"+o]=n)}))});var t="#postdivrich",e=!0,o="#post-body-content";if(!1===WPGlobusAdmin.data.support.editor&&(t="#titlediv",e=!1),!1===WPGlobusAdmin.data.support.title&&(e=!1),a(o).prepend(a(".wpglobus-post-body-tabs-list")),a.each(WPGlobusAdmin.tabs,function(o,n){"default"===n?(a(t).wrap('<div id="tab-default"></div>'),e&&a(a("#titlediv")).insertBefore(t)):(a(t+"-"+n).wrap('<div id="tab-'+n+'"></div>'),e&&a(a("#titlediv-"+n)).insertBefore(t+"-"+n))}),a(o).addClass("wpglobus-post-body-tabs").tabs({beforeActivate:function(t,e){var o=e.oldTab[0].id.replace("link-tab-",""),n=e.newTab[0].id.replace("link-tab-","");"default"==o&&(o=WPGlobusCoreData.default_language),"default"==n&&(n=WPGlobusCoreData.default_language);var i=a(document).triggerHandler("wpglobus_post_body_tabs",[o,n]);return!(!i&&void 0!==i)}}),a("#title").val(WPGlobusAdmin.title),a("#content").text(WPGlobusAdmin.content),"undefined"!=typeof WPGlobusVendor&&WPGlobusVendor.vendor.WPSEO&&("undefined"!=typeof wpglobus_wpseo?wpglobus_wpseo():"undefined"!=typeof WPGlobusYoastSeo&&("undefined"!=typeof WPGlobusYoastSeoPremium&&WPGlobusYoastSeoPremium&&WPGlobusYoastSeoPremium.init(),WPGlobusYoastSeo.init())),WPGlobusAdmin.data.modify_excerpt){var n=a("#excerpt");n.addClass("hidden").css({display:"none"}),a(WPGlobusAdmin.data.template).insertAfter(n),a("body").on("change",".wpglobus-excerpt",function(){var t=a(this);n.val(WPGlobusCore.getString(n.val(),t.val(),t.data("language")))})}if(void 0!==wp.utils&&void 0!==wp.utils.WordCounter){WPGlobusCoreData.wordCounter={};var i=this,l={};a.each(WPGlobusCoreData.enabled_languages,function(t,a){if(a==WPGlobusCoreData.default_language)return!0;l[t]="content_"+a,e=jQuery,o=new wp.utils.WordCounter,n=a,WPGlobusCoreData.wordCounter[n]={},WPGlobusCoreData.wordCounter[n].counter=o,e(function(){WPGlobusCoreData.wordCounter[n].content=e("#content_"+n),WPGlobusCoreData.wordCounter[n].count=e("#wp-word-count-"+n).find(".word-count-"+n),WPGlobusCoreData.wordCounter[n].prevCount=0;function t(t){var a,e;"object"==typeof t&&(t="tinymce"==t?i.getCurrentTab():t.target.id.replace("content_","")),void 0!==WPGlobusCoreData.wordCounter[t]&&(a=!WPGlobusCoreData.wordCounter[t].contentEditor||WPGlobusCoreData.wordCounter[t].contentEditor.isHidden()?WPGlobusCoreData.wordCounter[t].content.val():WPGlobusCoreData.wordCounter[t].contentEditor.getContent({format:"raw"}),(e=WPGlobusCoreData.wordCounter[t].counter.count(a))!==WPGlobusCoreData.wordCounter[t].prevCount&&WPGlobusCoreData.wordCounter[t].count.text(e),WPGlobusCoreData.wordCounter[t].prevCount=e)}e(document).on("tinymce-editor-init",function(a,o){if(-1!=e.inArray(o.id,l)){var n=o.id.replace("content_","");WPGlobusCoreData.wordCounter[n].contentEditor=o,o.on("nodechange keyup",_.debounce(t,1e3))}}),WPGlobusCoreData.wordCounter[n].content.on("input keyup",_.debounce(t,1e3)),t(n)});var e,o,n})}a(document).on("click","#publish, #save-post",function(){if(WPGlobusAdmin.data.open_languages.length>1){a(document).triggerHandler("wpglobus_before_save_post",{content_tabs_id:o});var t,e=a("#title").val(),n="",i="";0==e.length&&(t=WPGlobusAdmin.data.open_languages.indexOf(WPGlobusAdmin.data.default_language),WPGlobusAdmin.data.open_languages.splice(t,1),a(WPGlobusAdmin.data.open_languages).each(function(t,o){i=0==t?"":"-",(e=a("#title_"+o).val()).length>0&&(0==n.length&&(i=""),n=n+i+e)})),n.length>0&&a("#title").val(n)}void 0===WPGlobusAdmin.data.tagsdiv||WPGlobusAdmin.data.tagsdiv.length<1||a(WPGlobusAdmin.data.tagsdiv).each(function(t,e){if(0==a("#"+e).length)return!0;var o=e.replace("tagsdiv-","");if("undefined"===o)return!0;if(0==a("#tax-input-"+o).length)return!0;var n,i=[];a("#tagsdiv-"+o+" .tagchecklist li").each(function(t,e){n=(n=a(e).html()).replace(/<button.*<\/button>&nbsp;/,""),void 0===WPGlobusAdmin.data.tag[o][n]?i[t]=n:i[t]=WPGlobusAdmin.data.tag[o][n]}),a("#tax-input-"+o).val(i.join(", "))})}),a(".ui-state-default").on("click",function(){"link-tab-default"===a(this).attr("id")&&(a(window).scrollTop(a(window).scrollTop()+1),a(window).scrollTop(a(window).scrollTop()-1))}),a(document).on("tabsactivate",o,function(t,a){WPGlobusAdmin.currentTab=a.newTab[0].dataset.language}),a(document).triggerHandler("wpglobus_after_post_edit")},adminCentral:function(){a(".wpglobus-admin-central-tab").css({display:"none"}),a(".nav-tab-active").length>1&&a(".wpglobus-about-wrap .nav-tab-wrapper a").removeClass("nav-tab-active");var t=!0;0==location.hash.indexOf("#")&&a(".wpglobus-about-wrap .nav-tab-wrapper a").each(function(e,o){a(o).attr("href")==location.hash&&(t=!1,a(o).addClass("nav-tab-active"))}),t&&a(".wpglobus-about-wrap .nav-tab-wrapper a").eq(0).addClass("nav-tab-active");var e=a(".wpglobus-about-wrap .nav-tab-active").data("tab-id");""!=e&&a("#"+e).css({display:"block"}),a(document).on("click",".wpglobus-about-wrap .nav-tab",function(t){var e=a(this);e.hasClass("nav-tab-active")||(a(".wpglobus-admin-central-tab").css({display:"none"}),a(".wpglobus-about-wrap .nav-tab").removeClass("nav-tab-active"),e.addClass("nav-tab-active"),""!=e.data("tab-id")&&a("#"+e.data("tab-id")).css({display:"block"}))})},start:function(){var t=this;a("#wpglobus_flags").select2({formatResult:this.format,formatSelection:this.format,minimumResultsForSearch:-1,escapeMarkup:function(t){return t}}),a("body").on("click","#enabled_languages-list li:first input",function(e){return e.preventDefault(),a(".redux-save-warn").css({display:"none"}),a("#enabled_languages-list").find("li:first > input").val("1"),0===a("#disable_first_language").length&&a(t.config.disable_first_language).insertAfter("#info_bar"),!1})},format:function(t){return'<img class="wpglobus_flag" src="'+WPGlobusAdmin.flag_url+t.text+'"/>&nbsp;&nbsp;'+t.text},set_dialog:function(){if(void 0===WPGlobusAdmin.data.customFieldsEnabled||(WPGlobusAdmin.data.customFieldsEnabled=this.parseBool(WPGlobusAdmin.data.customFieldsEnabled),WPGlobusAdmin.data.customFieldsEnabled)){var t,e=!1,o=function(t){var o,n,i,l="wpglobus_dialog_start wpglobus_dialog_icon";i=['<div class="wpglobus_dialog_options_wrapper hidden">','<input style="width:initial;" id="wpglobus-cb-{{id}}" data-object="#wpglobus-dialog-start-{{id}}" data-meta-key="{{meta-key}}" class="wpglobus_dialog_option wpglobus_dialog_cb" type="checkbox" {{checked}} />',"</div>"].join(""),a(void 0===t?"#the-list tr":"#the-list tr#"+t).each(function(){var t,e,s,d=a(this),u=d.attr("id"),r=d.find("textarea"),c=l;if(void 0===(o=r.attr("id")))return!0;s=a("#"+u+"-key").val(),t=a("#"+o).clone(),a(r).addClass("wpglobus-dialog-field-source hidden"),e=r.attr("name"),a(t).attr("id","wpglobus-"+o),a(t).attr("name","wpglobus-"+e),a(t).attr("data-source-id",o),a(t).attr("class","wpglobus-dialog-field"),a(t).val(WPGlobusCore.TextFilter(a(r).val(),WPGlobusCoreData.language)),a(t).insertAfter(r),n=(n=i.replace(/{{id}}/g,o)).replace(/{{meta-key}}/g,s),void 0===WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type]?n=n.replace(/{{checked}}/,"checked"):void 0!==WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][s]&&"false"==WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][s]?(n=n.replace(/{{checked}}/,""),c=l+" wpglobus_dialog_start_hidden"):(n=n.replace(/{{checked}}/,"checked"),c=l),d.append('<td style="width:20px;"><div id="wpglobus-dialog-start-'+o+'" data-type="control" data-source-type="textarea" data-source-id="'+o+'" class="'+c+'"></div>'+n+"</td>")}),!e&&a("#list-table .wpglobus_dialog_start").length>0&&(a("#list-table thead tr").append('<th class="wpglobus-control-head"><div class="wpglobus_dialog_settings wpglobus_dialog_icon"></div></th>'),e=!0)};o(),a("body").on("change",".wpglobus-dialog-field",function(){var t,e=a(this),o="#"+e.data("source-id"),n="",i="";void 0!==o&&(n=a(o).val(),/(\{:|\[:|<!--:)[a-z]{2}/.test(n)?(a.each(WPGlobusCoreData.enabled_languages,function(a,o){""!=(t=o==WPGlobusCoreData.language?e.val():WPGlobusCore.TextFilter(n,o,"RETURN_EMPTY"))&&(i+=WPGlobusCore.addLocaleMarks(t,o))}),a(o).val(i)):a(o).val(e.val()))}),a(document).ajaxSend(function(a,e,o){"add-meta"==o.action&&(t=o.element)}),a(document).ajaxComplete(function(e,n,i){"add-meta"==i.action&&void 0!==n.responseXML&&o("newmeta"==t?"meta-"+a(n.responseXML.documentElement.outerHTML).find("meta").attr("id"):t)}),WPGlobusDialogApp.init({dialogTitle:"Edit meta"})}}},new t.App,t);var t,a});
1
+ var WPGlobusCore,WPGlobusDialogApp;!function(i){var d;d=WPGlobusCore={strpos:function(t,a,e){var o=(t=""+t).indexOf(a,e);return 0<=o&&o},TextFilter:function(t,a,e){if(void 0===t||""===t)return t;var o,n,i=[],l=!1;a=""==a?"en":a,e=void 0===e||""==e?"RETURN_IN_DEFAULT_LANGUAGE":e,i[0]=[],i[0].start=WPGlobusCoreData.locale_tag_start.replace("%s",a),i[0].end=WPGlobusCoreData.locale_tag_end,i[1]=[],i[1].start="\x3c!--:"+a+"--\x3e",i[1].end="\x3c!--:--\x3e",i[2]=[],i[2].start="[:"+a+"]",i[2].end="[:";for(var s=0;s<3;s++)if(!1!==(o=d.strpos(t,i[s].start))){o+=i[s].start.length,t=!1===(n=d.strpos(t,i[s].end,o))?t.substr(o):t.substr(o,n-o),l=!0;break}return l||("RETURN_EMPTY"==e?(a!=WPGlobusCoreData.default_language||/(\{:|\[:|<!--:)[a-z]{2}/.test(t))&&(t=""):a==WPGlobusCoreData.default_language?/(\{:|\[:|<!--:)[a-z]{2}/.test(t)&&(t=""):t=d.TextFilter(t,WPGlobusCoreData.default_language)),t},addLocaleMarks:function(t,a){return WPGlobusCoreData.locale_tag_start.replace("%s",a)+t+WPGlobusCoreData.locale_tag_end},getTranslations:function(e){var o,n={};return i.each(WPGlobusCoreData.enabled_languages,function(t,a){o=a==WPGlobusCoreData.default_language?"RETURN_IN_DEFAULT_LANGUAGE":"RETURN_EMPTY",n[a]=d.TextFilter(e,a,o)}),n},getString:function(t,a,e){if(void 0===t)return t;void 0===a&&(a=""),void 0===e&&(e=WPGlobusCoreData.language),(t=d.getTranslations(t))[e]=a;var o="";return i.each(t,function(t,a){""!=a&&t!=WPGlobusCoreData.default_language&&(o+=d.addLocaleMarks(a,t))}),""!=t[WPGlobusCoreData.default_language]&&(o=""==o?t[WPGlobusCoreData.default_language]:d.addLocaleMarks(t[WPGlobusCoreData.default_language],WPGlobusCoreData.default_language)+o),o}}}(jQuery),function(m){var v;v=WPGlobusDialogApp={option:{listenClass:".wpglobus_dialog_start",settingsClass:".wpglobus_dialog_settings",dialogTabs:"#wpglobus-dialog-tabs",dialogTitle:"",customData:null,callback:function(){},dialogOptions:{title:"",placeholder:"",formFooter:"",beforeOpen:function(){},close:function(){}},dialog:{}},form:void 0,element:void 0,element_by:"id",id:"",clone_id:"",wpglobus_id:"",type:"textarea",source:"",order:{},value:{},request:"core",attrs:{},dialogTitle:"",trClass:"wpglobus-translatable",startButton:['<span id="wpglobus-dialog-start-{{clone_id}}" ','style="{{style}}" ','data-type="control" data-dialog-title="{{title}}" ','data-source-type="" data-source-id="{{id}}" data-source-name="{{name}}" ','data-nodename="{{nodename}}"',"{{sbTitle}} ",'class="{{classes}}"></span>'].join(""),startButtonClass:"wpglobus_dialog_start wpglobus_dialog_icon",clicks:0,init:function(t){v.option.dialog=v.option.dialogOptions,v.option=m.extend(v.option,t),m(v.option.dialogTabs).tabs(),v.dialogTitle=v.option.dialogTitle,this.attachListener(),null!=v.option.customData&&void 0!==v.option.customData.addElements&&m.each(v.option.customData.addElements,function(t,a){v.addElement(a)})},convertToId:function(t){return t=(t=t.replace(/\]/g,"")).replace(/\[/g,"-")},addElement:function(t){var a={id:null,style:"",styleTextareaWrapper:"",sbTitle:"",onChangeClass:"",dialogTitle:"",dialog:v.option.dialogOptions};if("string"==typeof t)a.id=t;else{if("object"!=typeof t)return;a=m.extend(a,t)}var e,o,n,i=null,l=null,s=null,d=null,u=v.startButton,r="";if(v.element_by="name",0==(d=document.getElementsByName(a.id)).length&&(v.element_by="id",d=document.getElementById(a.id)),null!==d){if(l=a.id,"id"==v.element_by?i=m("#"+l):(r=(r=d[0].nodeName).toLowerCase(),i=m(r+'[name="'+l+'"]')),s=void 0===i.attr("name")||""==i.attr("name")?l:i.attr("name"),v.clone_id=v.convertToId(l),-1!=s.indexOf("wpglobus")||-1!=v.clone_id.indexOf("wpglobus"))return!1;if(0<m("#wpglobus-"+v.clone_id).length)return!1;if(0<m(r+'[name="wpglobus-'+s+'"]').length)return!1;e=m(i.clone()),n=i.attr("style")||"",i.attr("style","display:none;"),e.attr("id","wpglobus-"+v.clone_id).attr("name","wpglobus-"+s),e.addClass(v.trClass),""!=a.onChangeClass&&e.addClass(a.onChangeClass),"id"==v.element_by?e.attr("data-source-id",l).attr("data-source-name","").attr("data-source-get-by",v.element_by):e.attr("data-source-id","").attr("data-source-name",s).attr("data-source-get-by",v.element_by),"textarea"==r?(o=WPGlobusCore.getTranslations(i.val())[WPGlobusCoreData.language],e.val(o),e.attr("data-nodename","textarea"),""==a.style?e.attr("style",n+";width:95%;float:left;"):e.attr("style",n+";"+a.style)):(o=WPGlobusCore.getTranslations(i.val())[WPGlobusCoreData.language],e.attr("value",o),e.attr("data-nodename","input"),""!=a.style&&e.attr("style",n+";"+a.style)),""!=a.dialog&&e.attr("data-dialog",JSON.stringify(a.dialog)),u=u.replace(/{{clone_id}}/g,v.clone_id),u="id"==v.element_by?(u=(u=u.replace(/{{id}}/g,v.clone_id)).replace(/{{name}}/g,"")).replace(/{{nodename}}/g,""):(u=(u=u.replace(/{{id}}/g,"")).replace(/{{name}}/g,s)).replace(/{{nodename}}/g,r),u="textarea"==r?u.replace("{{style}}","float:left;margin-top:0;"):u.replace("{{style}}","");var c="textarea"==r?v.startButtonClass+" wpglobus-textarea wpglobus-textarea-"+v.clone_id:v.startButtonClass;u=u.replace("{{classes}}",c),u=""==a.dialogTitle?u.replace("{{title}}",v.dialogTitle):u.replace("{{title}}",a.dialogTitle),u=""==a.sbTitle?u.replace("{{sbTitle}}",a.sbTitle):u.replace("{{sbTitle}}",'title="'+a.sbTitle+'"'),m(u).insertAfter(i),m(e).insertAfter(i),"textarea"==r&&(m("#wpglobus-"+v.clone_id).addClass("wpglobus-textarea-"+v.clone_id),m(".wpglobus-textarea-"+v.clone_id).wrapAll('<div class="wpglobus-textarea-wrapper" style="'+a.styleTextareaWrapper+'"></div>'));var g,b=!1;if(""==a.onChangeClass)g="#wpglobus-"+v.clone_id;else{g="."+a.onChangeClass;var p=m._data(m(document)[0],"events");void 0===p?b=!0:void 0!==p.change&&m.each(p.change,function(t,a){if(a.selector==g)return b=!0,!1})}return b||m(document).on("change",g,function(){var t=m(this),a=t.data("source-id");a=""==a?t.data("nodename")+'[name="'+t.data("source-name")+'"]':"#"+a,m(a).val(WPGlobusCore.getString(m(a).val(),t.val()))}),!0}},saveDialog:function(){var e,o,n,i="",l="",s="";m(".wpglobus_dialog_textarea").each(function(t,a){e=m(a),o=e.val(),(n=e.data("language"))==WPGlobusAdmin.data.language&&(s=o),""!=o&&(i+=WPGlobusCore.addLocaleMarks(o,n),n==WPGlobusCoreData.default_language&&(l=o))}),i=i.length==l.length+8?l:i,m(v.id).val(i),i=""==s?l:s,m(v.wpglobus_id).val(i)},dialog:m("#wpglobus-dialog-wrapper").dialog({autoOpen:!1,width:650,modal:!0,dialogClass:"wpglobus-dialog",buttons:[{text:"Save",class:"wpglobus-button-save",click:function(){v.saveDialog(),v.dialog.dialog("close")}},{text:"Cancel",class:"wpglobus-button-cancel",click:function(){v.dialog.dialog("close")}}],open:function(t,a){var e=v.dialogTitle;void 0!==v.attrs.maxlength&&(m(".wpglobus_dialog_textarea").attr("maxlength",v.attrs.maxlength),e+=" | maxlength="+v.attrs.maxlength),m(".wpglobus-dialog .ui-dialog-title").text(e)},close:function(){v.runCallback(v.option.dialog.close),v.form[0].reset()}}),attachListener:function(){m(document).on("click",v.option.settingsClass,function(){m(".wpglobus_dialog_options_wrapper").hasClass("hidden")?m(".wpglobus_dialog_options_wrapper").removeClass("hidden"):m(".wpglobus_dialog_options_wrapper").addClass("hidden")}),m(document).on("click",".wpglobus_dialog_option",function(t){var a=m(this),e=a.data("object");v.order.action="save_post_meta_settings",v.order.post_type=WPGlobusAdmin.data.post_type,v.order.checked=a.prop("checked"),v.order.id=a.attr("id"),v.order.meta_key=a.data("meta-key"),v.ajax(v.order).done(function(t){"ok"==t.result&&("true"==t.checked?m(e).removeClass("wpglobus_dialog_start_hidden"):m(e).addClass("wpglobus_dialog_start_hidden"))}).fail(function(t){}).always(function(t,a){})}),m(document).on("click",v.option.listenClass,function(a){v.element=m(this),v.id=v.element.data("source-id"),""==v.id?(v.id=v.element.data("nodename")+'[name="'+v.element.data("source-name")+'"]',v.wpglobus_id="#wpglobus-"+v.convertToId(v.element.data("source-name"))):(v.wpglobus_id="#wpglobus-"+v.id,v.id="#"+v.id),v.clicks++,1==v.clicks&&setTimeout(function(){if(1==v.clicks)v.onClick(a);else{var t=m(v.id);t.hasClass("hidden")?t.removeClass("hidden").attr("style","display:block;"):t.addClass("hidden").attr("style","display:none;")}v.clicks=0},200)}),v.form=v.dialog.find("form#wpglobus-dialog-form").on("submit",function(t){t.preventDefault(),v.saveDialog()})},ajax:function(t){return m.ajax({type:"POST",url:WPGlobusAdmin.ajaxurl,data:{action:WPGlobusAdmin.process_ajax,order:t},dataType:"json",async:!1})},onClick:function(t){void 0===v.element.data("dialog-title")||""==v.element.data("dialog-title")?v.dialogTitle=v.option.dialogTitle:v.dialogTitle=v.element.data("dialog-title"),void 0!==v.id&&(v.attrs.maxlength=m(v.id).attr("maxlength")),v.source=v.element.data("source-value"),void 0===v.source&&(v.source=m(v.id).val(),"ajax"==v.request||(v.value=WPGlobusCore.getTranslations(v.source))),v.option.dialog=m.extend({},v.option.dialogOptions,m(v.wpglobus_id).data("dialog")),""!=v.option.dialog.title&&(v.dialogTitle=v.option.dialog.title),m.each(v.value,function(t,a){var e=m("#wpglobus-dialog-"+t);e.val(a),e.attr("placeholder",WPGlobusCore.TextFilter(v.option.dialog.placeholder,t,"RETURN_IN_DEFAULT_LANGUAGE"))}),m("#wpglobus-dialog-form-footer").html(v.option.dialog.formFooter),v.runCallback(v.option.dialog.beforeOpen),v.dialog.dialog("open")},runCallback:function(t){if("object"==typeof t){var a=Object.keys(t)[0],e=t[Object.keys(t)[0]];"window"===a?"function"==typeof window[e]&&window[e](t[Object.keys(t)[1]]):"function"==typeof window[a][e]&&window[a][e](t[Object.keys(t)[1]])}else"string"==typeof t&&"function"==typeof window[t]&&window[t]()}}}(jQuery),jQuery(document).ready(function(){"use strict";var t,c;window.WPGlobusAdminApp=(t=window.WPGlobusAdminApp||{},c=jQuery,t.App=function(t){void 0===window.WPGlobusAdminApp&&(this.config={debug:!1,version:WPGlobusAdmin.version},this.status="ok","undefined"==typeof WPGlobusAdmin?(this.status="error",this.config.debug&&console.log("WPGlobus: error options loading")):this.config.debug&&console.dir(WPGlobusAdmin),this.config.disable_first_language=['<div id="disable_first_language" style="display:block;" class="redux-field-errors notice-red">',"<strong>","<span>&nbsp;</span>",WPGlobusAdmin.i18n.cannot_disable_language,"</strong>","</div>"].join(""),c.extend(this.config,t),"ok"===this.status&&this.init())},t.App.prototype={$document:c(document),init:function(){WPGlobusCoreData.multisite=this.parseBool(WPGlobusCoreData.multisite),this.adminInit(),c("#content").addClass("wpglobus-editor").attr("data-language",WPGlobusAdmin.data.default_language),c("textarea[id^=content_]").each(function(t,a){var e=c(a).attr("id").replace("content_","");c(a).attr("data-language",e)}),"post.php"===WPGlobusAdmin.page?(this.postEdit(),this.set_dialog(),"undefined"!=typeof WPGlobusAioseop&&WPGlobusAioseop.init()):"menu-edit"===WPGlobusAdmin.page?this.navMenus():"taxonomy-edit"===WPGlobusAdmin.page?WPGlobusAdmin.data.tag_id&&this.taxonomyEdit():"taxonomy-quick-edit"===WPGlobusAdmin.page?this.quickEdit("taxonomy"):"edit.php"===WPGlobusAdmin.page?this.quickEdit("post"):"options-general.php"==WPGlobusAdmin.page?(this.optionsGeneral(),WPGlobusDialogApp.init({customData:WPGlobusCoreData.page_custom_data})):"widgets.php"==WPGlobusAdmin.page?(WPGlobusWidgets.init(),WPGlobusDialogApp.init({dialogTitle:"Edit text"})):"wpglobus_options"==WPGlobusAdmin.page?this.start():"wpglobusAdminCentral"==WPGlobusAdmin.page?this.adminCentral():WPGlobusDialogApp.init({customData:WPGlobusCoreData.page_custom_data})},parseBool:function(t){return!/^(false|0)$/i.test(t)&&!!t},getCurrentTab:function(){return c(".wpglobus-post-body-tabs-list .ui-tabs-active").data("language")},adminInit:function(){var t=c(".wpglobus-addons-group a").data("key");if(void 0!==t)if(0<=window.location.search.indexOf("page=wpglobus_options&tab="+t))WPGlobusCoreData.multisite?window.location=WPGlobusCoreData.pluginInstallLocation.multisite:window.location=WPGlobusCoreData.pluginInstallLocation.single;else{var a=c("#toplevel_page_wpglobus_options li").eq(t+1);WPGlobusCoreData.multisite?c(a).find("a").attr("href",WPGlobusCoreData.pluginInstallLocation.multisite).attr("onclick","window.location=jQuery(this).attr('href');return false;"):c(a).find("a").attr("href",WPGlobusCoreData.pluginInstallLocation.single).attr("onclick","window.location=jQuery(this).attr('href');return false;")}},optionsGeneral:function(){var o=c("#blogname"),t=c("body");o.addClass("hidden"),c("#wpglobus-blogname").insertAfter(o).removeClass("hidden"),t.on("blur",".wpglobus-blogname",function(){c(".wpglobus-blogname").each(function(t,a){var e=c(a);o.val(WPGlobusCore.getString(o.val(),e.val(),e.data("language")))})});var n=c("#blogdescription");n.addClass("hidden"),c("#wpglobus-blogdescription").insertAfter(n).removeClass("hidden"),t.on("blur",".wpglobus-blogdesc",function(){c(".wpglobus-blogdesc").each(function(t,a){var e=c(a);n.val(WPGlobusCore.getString(n.val(),e.val(),e.data("language")))})})},quickEdit:function(n){if(void 0!==WPGlobusAdmin.data.has_items&&WPGlobusAdmin.data.has_items){var o="",l=0;c(document).ajaxComplete(function(t,a,e){void 0!==e.data&&""!=o&&0<=e.data.indexOf("action=inline-save-tax&")&&(c("#"+o+" a.row-title").text(WPGlobusAdmin.qedit_titles[l][WPGlobusAdmin.data.language].name),c("#"+o+" .description").text(WPGlobusAdmin.qedit_titles[l][WPGlobusAdmin.data.language].description))});var i={};c("#the-list tr").each(function(t,a){var e=c(a),o="post"===n?"post-":"tag-";l=e.attr("id").replace(o,""),i[l]={},"post"===n?i[l].source=e.find(".post_title").text():"taxonomy"===n&&(i[l].source=c("#inline_"+l+" .name").text())});var t={action:"get_titles"};t.type=n,t.taxonomy=void 0!==WPGlobusAdmin.data.taxonomy&&WPGlobusAdmin.data.taxonomy,t.title=i,c.ajax({type:"POST",url:WPGlobusAdmin.ajaxurl,data:{action:WPGlobusAdmin.process_ajax,order:t},dataType:"json"}).done(function(t){WPGlobusAdmin.qedit_titles=t.qedit_titles,c.each(t.bulkedit_post_titles,function(t,a){c("#inline_"+t+" .post_title").text(a[WPGlobusAdmin.data.language].name)})}).fail(function(t){}).always(function(t,a){}),c("body").on("change",".wpglobus-quick-edit-title",function(){var n="",i=[];c(".wpglobus-quick-edit-title").each(function(t,a){var e=c(a),o=e.data("language");""!==e.val()&&(n=WPGlobusCore.getString(n,e.val(),o)),WPGlobusAdmin.qedit_titles[l][o].name=e.val(),i[t]=o});var t=c(document).triggerHandler("wpglobus_get_translations",{string:n,lang:i,id:l});void 0!==t&&(n=t),c("input.ptitle").eq(0).attr("value",n),WPGlobusAdmin.qedit_titles[l].source=n}),void 0!==WPGlobusAdmin.data.tags&&c.each(WPGlobusAdmin.data.tags,function(t,a){WPGlobusAdmin.data.value[a].post_id={}}),c("button.save, input#bulk_edit").on("mouseenter",function(t){void 0!==WPGlobusAdmin.data.tags&&("bulk_edit"==t.currentTarget.id?c("input#bulk_edit").unbind("click"):c("button.save").unbind("click"),c("button.save, input#bulk_edit").on("click",function(a){var t=c.when(),e=(c(this),c.Deferred());e.resolve(function(t){t.next(".spinner").css({visibility:"visible"}),"bulk_edit"!=a.currentTarget.id&&c.ajaxSetup({async:!1});var o,n,i,l=t.parents("tr"),s=l.attr("id").replace("edit-","");c.each(WPGlobusAdmin.data.tags,function(t,a){if(0==(o=l.find("textarea[name='"+WPGlobusAdmin.data.names[a]+"']")).length)return!0;WPGlobusAdmin.data.value[a].post_id[s]=o.val(),n=WPGlobusAdmin.data.value[a].post_id[s].split(","),i=[];for(var e=0;e<n.length;e++)n[e]=n[e].trim(" "),""!=n[e]&&(void 0===WPGlobusAdmin.data.tag[a][n[e]]?i[e]=n[e]:i[e]=WPGlobusAdmin.data.tag[a][n[e]]);o.val(i.join(", "))})}(c(this))),t=t.then(function(){return c.when(e.done())}).then(function(){"bulk_edit"!=a.currentTarget.id&&setTimeout(function(){inlineEditPost.save(l),c.ajaxSetup({async:!0})},50)})}))}),c("#the-list").on("click","a.editinline",function(){var t=c(this);if(o=t.parents("tr").attr("id"),"post"===n)l=o.replace("post-","");else{if("taxonomy"!==n)return;l=o.replace("tag-","")}"post"===n&&void 0!==WPGlobusAdmin.data.tags&&c.each(WPGlobusAdmin.data.tags,function(t,a){if(""!=WPGlobusAdmin.data.value[a]){var e,o=c("#edit-"+l+' textarea[name="'+WPGlobusAdmin.data.names[a]+'"]').val();void 0!==o&&(e=o.split(","),c.each(e,function(t,a){o=o.replace(a,WPGlobusCore.TextFilter(a,WPGlobusCoreData.language))}),c("#edit-"+l+' textarea[name="'+WPGlobusAdmin.data.names[a]+'"]').val(o))}});var a=c("#edit-"+l+" input.ptitle").eq(0),e=a.parents("label");a.val(WPGlobusAdmin.qedit_titles[l].source),a.addClass("hidden"),c(WPGlobusAdmin.data.template).insertAfter(e),void 0===WPGlobusAdmin.qedit_titles[l]&&(WPGlobusAdmin.qedit_titles[l]={},WPGlobusAdmin.qedit_titles[l].source=c("#"+o+" .name a.row-title").text(),c(WPGlobusAdmin.data.enabled_languages).each(function(t,a){WPGlobusAdmin.qedit_titles[l][a]={},a==WPGlobusAdmin.data.default_language?WPGlobusAdmin.qedit_titles[l][a].name=WPGlobusAdmin.qedit_titles[l].source:WPGlobusAdmin.qedit_titles[l][a].name="",WPGlobusAdmin.qedit_titles[l][a].description=""})),c(".wpglobus-quick-edit-title").each(function(t,a){var e=c(a),o=e.data("language");e.attr("id",o+l),void 0!==WPGlobusAdmin.qedit_titles[l][o]&&(WPGlobusAdmin.qedit_titles[l][o].name=WPGlobusAdmin.qedit_titles[l][o].name.replace(/\\\'/g,"'"),WPGlobusAdmin.qedit_titles[l][o].name=WPGlobusAdmin.qedit_titles[l][o].name.replace(/\\\"/g,'"'),e.attr("value",WPGlobusAdmin.qedit_titles[l][o].name),WPGlobusAdmin.qedit_titles[l].source=WPGlobusCore.getString(WPGlobusAdmin.qedit_titles[l].source,WPGlobusAdmin.qedit_titles[l][o].name,o))}),c("input.ptitle").eq(0).attr("value",WPGlobusAdmin.qedit_titles[l].source)})}},taxonomyEdit:function(){var a=[];a[0]="name",a[1]="description",c.each(WPGlobusCoreData.enabled_languages,function(t,u){c.each(a,function(t,a){var e,o,n,i,l,s,d;o=u,i=c("#"+(e=a)),l=i.clone(),s=i.attr("name"),d="wpglobus-element wpglobus-element_"+e+" wpglobus-element_"+o+" wpglobus-translatable",n=(n=document.getElementById(e)).nodeName,c(l).attr("id",e+"_"+o),c(l).attr("name",s+"_"+o),o!==WPGlobusCoreData.default_language&&(d+=" hidden"),c(l).attr("class",d),c(l).attr("data-save-to",e),c(l).attr("data-language",o),"INPUT"==n?c(l).attr("value",c("#wpglobus-link-tab-"+o).data(e)):"TEXTAREA"==n&&c(l).text(c("#wpglobus-link-tab-"+o).data(e)),i.addClass("hidden"),0==c(".wpglobus-element_"+e).length?c(l).insertAfter(i):c(l).insertAfter(c(".wpglobus-element_"+e).last())})}),c(".wpglobus-taxonomy-tabs").insertAfter("#ajax-response"),c(".wrap").tabs(),c("body").on("click",".wpglobus-taxonomy-tabs li",function(t){var a=c(this).data("language");c(".wpglobus-element").addClass("hidden"),c(".wpglobus-element_"+a).removeClass("hidden")}),c(".wpglobus-element").on("change",function(){var n=c(this).data("save-to"),i="";c(".wpglobus-element").each(function(t,a){var e=c(a),o=e.val();e.data("save-to")==n&&""!==o&&(i+=WPGlobusCore.addLocaleMarks(o,e.data("language")))}),c("#"+n).val(i)}),c(WPGlobusAdmin.data.multilingualSlug.title).insertAfter(".term-slug-wrap th label")},navMenus:function(){var e,o,n="#menu-to-edit .menu-item",i=function(){o!==c(n).length&&(clearInterval(e),c(n).each(function(t,a){var e=c(a);if(!e.hasClass("wpglobus-menu-item")){var l=c(a).attr("id");c.each(["input.edit-menu-item-title","input.edit-menu-item-attr-title"],function(t,a){var e=c("#"+l+" "+a),o=c(e);if(!o.hasClass("wpglobus-hidden")){o.addClass("wpglobus-hidden"),o.css("display","none");var n=o.parent("label"),i=o.parents("p");c(i).css("height","80px"),c(n).append('<div style="color:#f00;">'+WPGlobusAdmin.i18n.save_nav_menu+"</div>")}}),e.addClass("wpglobus-menu-item")}}))};c.ajaxSetup({beforeSend:function(t,a){void 0!==a.data&&0<=a.data.indexOf("action=add-menu-item")&&(o=c(n).length,e=setInterval(i,500))}}),c(n).each(function(t,a){var e=c(a).attr("id"),u=e.replace("menu-item-","");c.each(["input.edit-menu-item-title","input.edit-menu-item-attr-title"],function(n,i){var l=c("#"+e+" "+i);l.val()!=WPGlobusAdmin.data.items[u][i].source&&l.val(WPGlobusAdmin.data.items[u][i].source);var s=c("#"+e+" "+i).parents("p"),d=0;c.each(WPGlobusAdmin.data.open_languages,function(t,a){var e=l.clone();e.attr("id",l.attr("id")+"-"+a),e.attr("name",l.attr("id")+"-"+a),e.attr("data-language",a),e.attr("data-item-id",u),e.attr("placeholder",WPGlobusAdmin.data.en_language_name[a]);var o=WPGlobusAdmin.data.items[u][a][i].class;0===n&&a===WPGlobusAdmin.data.default_language?e.attr("class",o+" edit-menu-item-title"):e.attr("class",o),""!=WPGlobusAdmin.data.items[u][a][i].caption?e.attr("value",WPGlobusAdmin.data.items[u][a][i].caption):e.attr("value",""),e.css("margin-bottom","0.6em"),c(s).append(e),d=t}),d=40*(d+1),l.css("display","none").attr("class","").addClass("widefat wpglobus-hidden"),c(s).css("height",d+"px").addClass("wpglobus-menu-item-box")}),c(a).addClass("wpglobus-menu-item")}),c(".menus-move-left, .menus-move-right").each(function(t,a){var e,o=c(a),n=(o.parents("li").attr("id").replace("menu-item-",""),o.attr("title"));void 0!==n&&c.each(WPGlobusAdmin.data.post_titles,function(t,a){0<=n.indexOf(t)&&(e=n.replace(t,a),o.attr("title",e),o.text(e))})}),c(".edit-menu-item-title").trigger("change"),wpNavMenu.refreshAdvancedAccessibility(),wpNavMenu.menusChanged=!1,c(".wpglobus-menu-item").on("change",function(){var t,a,e=c(this),o=e.data("item-id");e.hasClass("wpglobus-item-title")&&(t=WPGlobusCore.getString(c("input#edit-menu-item-title-"+o).val(),e.val(),e.data("language")),void 0!==(a=c(document).triggerHandler("wpglobus_get_menu_translations",{string:t,lang:WPGlobusCoreData.open_languages,id:o,type:"input.edit-menu-item-title"}))&&(t=a),c("input#edit-menu-item-title-"+o).val(t)),e.hasClass("wpglobus-item-attr")&&(t=WPGlobusCore.getString(c("input#edit-menu-item-attr-title-"+o).val(),e.val(),e.data("language")),void 0!==(a=c(document).triggerHandler("wpglobus_get_menu_translations",{string:t,lang:WPGlobusCoreData.open_languages,id:o,type:"input.edit-menu-item-attr-title"}))&&(t=a),c("input#edit-menu-item-attr-title-"+o).val(t))})},postEdit:function(){c(document).on("heartbeat-send",function(t,o){void 0!==o.wp_autosave&&(o.wpglobus_heartbeat="wpglobus",c.each(WPGlobusAdmin.data.open_languages,function(t,a){var e=c("#title_"+a).val()||"";""!=(e=c.trim(e))&&(o.wp_autosave["post_title_"+a]=e),e=c("#content_"+a).val()||"",""!=(e=c.trim(e))&&(o.wp_autosave["content_"+a]=e)}))});var e="#postdivrich",o=!0,a="#post-body-content";if(!1===WPGlobusAdmin.data.support.editor&&(e="#titlediv",o=!1),!1===WPGlobusAdmin.data.support.title&&(o=!1),c(a).prepend(c(".wpglobus-post-body-tabs-list")),c.each(WPGlobusAdmin.tabs,function(t,a){"default"===a?(c(e).wrap('<div id="tab-default"></div>'),o&&c(c("#titlediv")).insertBefore(e)):(c(e+"-"+a).wrap('<div id="tab-'+a+'"></div>'),o&&c(c("#titlediv-"+a)).insertBefore(e+"-"+a))}),c(a).addClass("wpglobus-post-body-tabs").tabs({beforeActivate:function(t,a){var e=a.oldTab[0].id.replace("link-tab-",""),o=a.newTab[0].id.replace("link-tab-","");"default"==e&&(e=WPGlobusCoreData.default_language),"default"==o&&(o=WPGlobusCoreData.default_language);var n=c(document).triggerHandler("wpglobus_post_body_tabs",[e,o]);return!(!n&&void 0!==n)}}),c("#title").val(WPGlobusAdmin.title),c("#content").text(WPGlobusAdmin.content),"undefined"!=typeof WPGlobusVendor&&WPGlobusVendor.vendor.WPSEO&&("undefined"!=typeof wpglobus_wpseo?wpglobus_wpseo():"undefined"!=typeof WPGlobusYoastSeo&&("undefined"!=typeof WPGlobusYoastSeoPremium&&WPGlobusYoastSeoPremium&&WPGlobusYoastSeoPremium.init(),WPGlobusYoastSeo.init())),WPGlobusAdmin.data.modify_excerpt){var n=c("#excerpt");n.addClass("hidden").css({display:"none"}),c(WPGlobusAdmin.data.template).insertAfter(n),c("body").on("change",".wpglobus-excerpt",function(){var t=c(this);n.val(WPGlobusCore.getString(n.val(),t.val(),t.data("language")))})}if(void 0!==wp.utils&&void 0!==wp.utils.WordCounter){WPGlobusCoreData.wordCounter={};var l=this,s={};c.each(WPGlobusCoreData.enabled_languages,function(t,a){if(a==WPGlobusCoreData.default_language)return!0;var n,e,i;s[t]="content_"+a,n=jQuery,e=new wp.utils.WordCounter,i=a,WPGlobusCoreData.wordCounter[i]={},WPGlobusCoreData.wordCounter[i].counter=e,n(function(){function o(t){var a,e;"object"==typeof t&&(t="tinymce"==t?l.getCurrentTab():t.target.id.replace("content_","")),void 0!==WPGlobusCoreData.wordCounter[t]&&(a=!WPGlobusCoreData.wordCounter[t].contentEditor||WPGlobusCoreData.wordCounter[t].contentEditor.isHidden()?WPGlobusCoreData.wordCounter[t].content.val():WPGlobusCoreData.wordCounter[t].contentEditor.getContent({format:"raw"}),(e=WPGlobusCoreData.wordCounter[t].counter.count(a))!==WPGlobusCoreData.wordCounter[t].prevCount&&WPGlobusCoreData.wordCounter[t].count.text(e),WPGlobusCoreData.wordCounter[t].prevCount=e)}WPGlobusCoreData.wordCounter[i].content=n("#content_"+i),WPGlobusCoreData.wordCounter[i].count=n("#wp-word-count-"+i).find(".word-count-"+i),WPGlobusCoreData.wordCounter[i].prevCount=0,n(document).on("tinymce-editor-init",function(t,a){if(-1!=n.inArray(a.id,s)){var e=a.id.replace("content_","");(WPGlobusCoreData.wordCounter[e].contentEditor=a).on("nodechange keyup",_.debounce(o,1e3))}}),WPGlobusCoreData.wordCounter[i].content.on("input keyup",_.debounce(o,1e3)),o(i)})})}c(document).on("click","#publish, #save-post",function(){if(1<WPGlobusAdmin.data.open_languages.length){c(document).triggerHandler("wpglobus_before_save_post",{content_tabs_id:a});var t,e=c("#title").val(),o="",n="";0==e.length&&(t=WPGlobusAdmin.data.open_languages.indexOf(WPGlobusAdmin.data.default_language),WPGlobusAdmin.data.open_languages.splice(t,1),c(WPGlobusAdmin.data.open_languages).each(function(t,a){n=0==t?"":"-",0<(e=c("#title_"+a).val()).length&&(0==o.length&&(n=""),o=o+n+e)})),0<o.length&&c("#title").val(o)}void 0===WPGlobusAdmin.data.tagsdiv||WPGlobusAdmin.data.tagsdiv.length<1||c(WPGlobusAdmin.data.tagsdiv).each(function(t,a){if(0==c("#"+a).length)return!0;var e=a.replace("tagsdiv-","");if("undefined"===e)return!0;if(0==c("#tax-input-"+e).length)return!0;var o,n=[];c("#tagsdiv-"+e+" .tagchecklist li").each(function(t,a){o=(o=c(a).html()).replace(/<button.*<\/button>&nbsp;/,""),void 0===WPGlobusAdmin.data.tag[e][o]?n[t]=o:n[t]=WPGlobusAdmin.data.tag[e][o]}),c("#tax-input-"+e).val(n.join(", "))})}),c(".ui-state-default").on("click",function(){"link-tab-default"===c(this).attr("id")&&(c(window).scrollTop(c(window).scrollTop()+1),c(window).scrollTop(c(window).scrollTop()-1))}),c(document).on("tabsactivate",a,function(t,a){WPGlobusAdmin.currentTab=a.newTab[0].dataset.language}),c(document).triggerHandler("wpglobus_after_post_edit")},adminCentral:function(){c(".wpglobus-admin-central-tab").css({display:"none"}),1<c(".nav-tab-active").length&&c(".wpglobus-about-wrap .nav-tab-wrapper a").removeClass("nav-tab-active");var e=!0;0==location.hash.indexOf("#")&&c(".wpglobus-about-wrap .nav-tab-wrapper a").each(function(t,a){c(a).attr("href")==location.hash&&(e=!1,c(a).addClass("nav-tab-active"))}),e&&c(".wpglobus-about-wrap .nav-tab-wrapper a").eq(0).addClass("nav-tab-active");var t=c(".wpglobus-about-wrap .nav-tab-active").data("tab-id");""!=t&&c("#"+t).css({display:"block"}),c(document).on("click",".wpglobus-about-wrap .nav-tab",function(t){var a=c(this);a.hasClass("nav-tab-active")||(c(".wpglobus-admin-central-tab").css({display:"none"}),c(".wpglobus-about-wrap .nav-tab").removeClass("nav-tab-active"),a.addClass("nav-tab-active"),""!=a.data("tab-id")&&c("#"+a.data("tab-id")).css({display:"block"}))})},start:function(){var a=this;c("#wpglobus_flags").select2({formatResult:this.format,formatSelection:this.format,minimumResultsForSearch:-1,escapeMarkup:function(t){return t}}),c("body").on("click","#enabled_languages-list li:first input",function(t){return t.preventDefault(),c(".redux-save-warn").css({display:"none"}),c("#enabled_languages-list").find("li:first > input").val("1"),0===c("#disable_first_language").length&&c(a.config.disable_first_language).insertAfter("#info_bar"),!1})},format:function(t){return'<img class="wpglobus_flag" src="'+WPGlobusAdmin.flag_url+t.text+'"/>&nbsp;&nbsp;'+t.text},set_dialog:function(){if(void 0===WPGlobusAdmin.data.customFieldsEnabled||(WPGlobusAdmin.data.customFieldsEnabled=this.parseBool(WPGlobusAdmin.data.customFieldsEnabled),WPGlobusAdmin.data.customFieldsEnabled)){var o,a=!1,n=function(t){var s,d,u,r="wpglobus_dialog_start wpglobus_dialog_icon";u=['<div class="wpglobus_dialog_options_wrapper hidden">','<input style="width:initial;" id="wpglobus-cb-{{id}}" data-object="#wpglobus-dialog-start-{{id}}" data-meta-key="{{meta-key}}" class="wpglobus_dialog_option wpglobus_dialog_cb" type="checkbox" {{checked}} />',"</div>"].join(""),c(void 0===t?"#the-list tr":"#the-list tr#"+t).each(function(){var t,a,e,o=c(this),n=o.attr("id"),i=o.find("textarea"),l=r;if(void 0===(s=i.attr("id")))return!0;e=c("#"+n+"-key").val(),t=c("#"+s).clone(),c(i).addClass("wpglobus-dialog-field-source hidden"),a=i.attr("name"),c(t).attr("id","wpglobus-"+s),c(t).attr("name","wpglobus-"+a),c(t).attr("data-source-id",s),c(t).attr("class","wpglobus-dialog-field"),c(t).val(WPGlobusCore.TextFilter(c(i).val(),WPGlobusCoreData.language)),c(t).insertAfter(i),d=(d=u.replace(/{{id}}/g,s)).replace(/{{meta-key}}/g,e),void 0===WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type]?d=d.replace(/{{checked}}/,"checked"):void 0!==WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][e]&&"false"==WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][e]?(d=d.replace(/{{checked}}/,""),l=r+" wpglobus_dialog_start_hidden"):(d=d.replace(/{{checked}}/,"checked"),l=r),o.append('<td style="width:20px;"><div id="wpglobus-dialog-start-'+s+'" data-type="control" data-source-type="textarea" data-source-id="'+s+'" class="'+l+'"></div>'+d+"</td>")}),!a&&0<c("#list-table .wpglobus_dialog_start").length&&(c("#list-table thead tr").append('<th class="wpglobus-control-head"><div class="wpglobus_dialog_settings wpglobus_dialog_icon"></div></th>'),a=!0)};n(),c("body").on("change",".wpglobus-dialog-field",function(){var e,o,n=c(this),t="#"+n.data("source-id"),i="";void 0!==t&&(e=c(t).val(),/(\{:|\[:|<!--:)[a-z]{2}/.test(e)?(c.each(WPGlobusCoreData.enabled_languages,function(t,a){""!=(o=a==WPGlobusCoreData.language?n.val():WPGlobusCore.TextFilter(e,a,"RETURN_EMPTY"))&&(i+=WPGlobusCore.addLocaleMarks(o,a))}),c(t).val(i)):c(t).val(n.val()))}),c(document).ajaxSend(function(t,a,e){"add-meta"==e.action&&(o=e.element)}),c(document).ajaxComplete(function(t,a,e){"add-meta"==e.action&&void 0!==a.responseXML&&n("newmeta"==o?"meta-"+c(a.responseXML.documentElement.outerHTML).find("meta").attr("id"):o)}),WPGlobusDialogApp.init({dialogTitle:"Edit meta"})}}},new t.App,t)});
includes/js/wpglobus-admin-debug.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){"use strict";if("undefined"!=typeof WPGlobusAdminDebug){var u={init:function(u){setTimeout(function(){e('<a name="debug-box"></a>').appendTo("#wpwrap"),e("#wpglobus-admin-debug-box").detach().appendTo("#wpwrap"),e("#wpglobus-admin-debug-box").css({display:"block"})},1e3),setTimeout(function(){var u=1*e("#wpglobus-admin-debug-box .table1").css("height").replace("px","");u+=50,e("#wpglobus-admin-debug-box .table2").css({"margin-top":u+"px"})},1200)}};WPGlobusAdminDebug=e.extend({},WPGlobusAdminDebug,u),WPGlobusAdminDebug.init()}}(jQuery);
1
+ !function(u){"use strict";if("undefined"!=typeof WPGlobusAdminDebug){var e={init:function(e){setTimeout(function(){u('<a name="debug-box"></a>').appendTo("#wpwrap"),u("#wpglobus-admin-debug-box").detach().appendTo("#wpwrap"),u("#wpglobus-admin-debug-box").css({display:"block"})},1e3),setTimeout(function(){var e=1*u("#wpglobus-admin-debug-box .table1").css("height").replace("px","");e+=50,u("#wpglobus-admin-debug-box .table2").css({"margin-top":e+"px"})},1200)}};WPGlobusAdminDebug=u.extend({},WPGlobusAdminDebug,e),WPGlobusAdminDebug.init()}}(jQuery);
includes/js/wpglobus-admin.js CHANGED
@@ -1,1601 +1,1601 @@
1
- /**
2
- * WPGlobus Administration Core, Dialog, Admin
3
- * Interface JS functions
4
- *
5
- * @since 1.0.0
6
- *
7
- * @package WPGlobus
8
- * @subpackage Administration
9
- */
10
- /*jslint browser: true*/
11
- /*global jQuery, console, WPGlobusCore, WPGlobusDialogApp, WPGlobusAdmin, inlineEditPost */
12
-
13
- var WPGlobusCore;
14
-
15
- (function($) {
16
- var api;
17
- api = WPGlobusCore = {
18
- strpos: function( haystack, needle, offset){
19
- haystack = "" + haystack;
20
- var i = haystack.indexOf( needle, offset );
21
- return i >= 0 ? i : false;
22
- },
23
-
24
- TextFilter: function(text, language, return_in){
25
- if ( typeof text == 'undefined' || '' === text ) { return text; }
26
-
27
- var pos_start, pos_end, possible_delimiters = [], is_local_text_found = false;;
28
-
29
- language = '' == language ? 'en' : language;
30
- return_in = typeof return_in == 'undefined' || '' == return_in ? 'RETURN_IN_DEFAULT_LANGUAGE' : return_in;
31
-
32
- possible_delimiters[0] = [];
33
- possible_delimiters[0]['start'] = WPGlobusCoreData.locale_tag_start.replace('%s', language);
34
- possible_delimiters[0]['end'] = WPGlobusCoreData.locale_tag_end;
35
-
36
- possible_delimiters[1] = [];
37
- possible_delimiters[1]['start'] = '<!--:'+language+'-->';
38
- possible_delimiters[1]['end'] = '<!--:-->';
39
-
40
- possible_delimiters[2] = [];
41
- possible_delimiters[2]['start'] = '[:'+language+']';
42
- possible_delimiters[2]['end'] = '[:';
43
-
44
-
45
-
46
- for (var i = 0; i < 3; i++) {
47
-
48
- pos_start = api.strpos( text, possible_delimiters[i]['start'] );
49
- if ( pos_start === false ) {
50
- continue;
51
- }
52
-
53
- pos_start = pos_start + possible_delimiters[i]['start'].length;
54
-
55
- pos_end = api.strpos( text, possible_delimiters[i]['end'], pos_start );
56
-
57
- if ( pos_end === false ) {
58
- text = text.substr( pos_start );
59
- } else {
60
- text = text.substr( pos_start, pos_end - pos_start );
61
- }
62
-
63
- is_local_text_found = true;
64
- break;
65
-
66
- }
67
-
68
- if ( ! is_local_text_found ) {
69
- if ( return_in == 'RETURN_EMPTY' ) {
70
- if ( language == WPGlobusCoreData.default_language && ! /(\{:|\[:|<!--:)[a-z]{2}/.test(text) ) {
71
- //
72
- } else {
73
- text = '';
74
- }
75
- } else {
76
- // Try RETURN_IN_DEFAULT_LANGUAGE
77
- if ( language == WPGlobusCoreData.default_language ) {
78
- if ( /(\{:|\[:|<!--:)[a-z]{2}/.test(text) ) {
79
- text = '';
80
- }
81
- } else {
82
- text = api.TextFilter( text, WPGlobusCoreData.default_language );
83
- }
84
- }
85
- }
86
- return text;
87
- },
88
- addLocaleMarks: function(text, language) {
89
- return WPGlobusCoreData.locale_tag_start.replace('%s', language) + text + WPGlobusCoreData.locale_tag_end;
90
- },
91
- getTranslations: function(text) {
92
- var t = {},
93
- return_in;
94
- $.each(WPGlobusCoreData.enabled_languages, function(i,l){
95
- return_in = l == WPGlobusCoreData.default_language ? 'RETURN_IN_DEFAULT_LANGUAGE' : 'RETURN_EMPTY';
96
- t[l] = api.TextFilter(text, l, return_in);
97
- });
98
- return t;
99
- },
100
- getString: function(s, newVal, l) {
101
- if ( 'undefined' === typeof(s) ) {
102
- return s;
103
- }
104
- if ( 'undefined' === typeof(newVal) ) {
105
- newVal = '';
106
- }
107
- if ( 'undefined' === typeof(l) ) {
108
- l = WPGlobusCoreData.language;
109
- }
110
-
111
- s = api.getTranslations(s);
112
- s[l] = newVal;
113
-
114
- var cS = '';
115
-
116
- $.each(s, function(ln,val){
117
- if ( '' != val && ln != WPGlobusCoreData.default_language) {
118
- cS += api.addLocaleMarks(val, ln);
119
- }
120
- });
121
-
122
- if ( '' != s[WPGlobusCoreData.default_language] ) {
123
- if ( '' == cS ) {
124
- cS = s[WPGlobusCoreData.default_language];
125
- } else {
126
- cS = api.addLocaleMarks(s[WPGlobusCoreData.default_language], WPGlobusCoreData.default_language) + cS;
127
- }
128
- }
129
- return cS;
130
- }
131
- };
132
- })(jQuery);
133
-
134
- var WPGlobusDialogApp;
135
-
136
- (function($) {
137
-
138
- var api;
139
- api = WPGlobusDialogApp = {
140
- option : {
141
- listenClass : '.wpglobus_dialog_start',
142
- settingsClass : '.wpglobus_dialog_settings',
143
- dialogTabs: '#wpglobus-dialog-tabs',
144
- dialogTitle: '',
145
- customData: null,
146
- callback: function(){}
147
- },
148
- form : undefined,
149
- element : undefined,
150
- element_by : 'id',
151
- id : '',
152
- clone_id: '',
153
- wpglobus_id : '',
154
- type : 'textarea',
155
- source : '',
156
- order : {},
157
- value : {},
158
- request : 'core',
159
- attrs: {},
160
- dialogTitle: '',
161
- trClass: 'wpglobus-translatable',
162
- startButton: [
163
- '<span id="wpglobus-dialog-start-{{clone_id}}" ',
164
- 'style="{{style}}" ',
165
- 'data-type="control" data-dialog-title="{{title}}" ',
166
- 'data-source-type="" data-source-id="{{id}}" data-source-name="{{name}}" ',
167
- 'data-nodename="{{nodename}}"',
168
- '{{sbTitle}} ',
169
- 'class="{{classes}}"></span>'
170
- ].join(''),
171
- startButtonClass : 'wpglobus_dialog_start wpglobus_dialog_icon',
172
- clicks: 0,
173
- init: function(args) {
174
- api.option = $.extend(api.option, args);
175
- $(api.option.dialogTabs).tabs();
176
- api.dialogTitle = api.option.dialogTitle;
177
- this.attachListener();
178
- if ( api.option.customData != null && typeof api.option.customData.addElements != 'undefined' ) {
179
- $.each(api.option.customData.addElements, function(i,e) {
180
- api.addElement(e);
181
- });
182
- }
183
- },
184
- convertToId: function(s){
185
- s = s.replace(/\]/g,'');
186
- s = s.replace(/\[/g,'-');
187
- return s;
188
- },
189
- addElement: function(elem) {
190
- var option = {
191
- id: null,
192
- dialogTitle: '',
193
- style: '',
194
- styleTextareaWrapper: '',
195
- sbTitle: '',
196
- onChangeClass: ''
197
- }
198
- if ( 'string' == typeof(elem) ) {
199
- option.id = elem;
200
- } else if ( 'object' == typeof(elem) ) {
201
- option = $.extend(option, elem);
202
- } else {
203
- return;
204
- }
205
-
206
- var $element = null, id = null, name = null, node = null,
207
- sb = api.startButton,
208
- clone, v, style, nodeName = '';
209
-
210
- api.element_by = 'id';
211
-
212
- node = document.getElementById(option.id);
213
- if ( null === node ) {
214
- api.element_by = 'name';
215
- node = document.getElementsByName(option.id);
216
- } else {
217
- nodeName = node.nodeName;
218
- nodeName = nodeName.toLowerCase();
219
- }
220
- if ( 0 == node.length ) {
221
- return;
222
- } else {
223
- id = option.id;
224
- if ( 'id' == api.element_by ) {
225
- $element = $('#'+id);
226
- } else {
227
- nodeName = node[0].nodeName;
228
- nodeName = nodeName.toLowerCase();
229
- $element = $(nodeName+'[name="'+id+'"]');
230
- }
231
- }
232
-
233
- if ( 'undefined' === $element.attr('name') ) {
234
- name = id;
235
- } else {
236
- name = $element.attr('name');
237
- }
238
- api.clone_id = api.convertToId(id);
239
-
240
- if ( -1 != name.indexOf( 'wpglobus' ) || -1 != api.clone_id.indexOf( 'wpglobus' ) ) {
241
- /* prevent add element to itself */
242
- return;
243
- }
244
-
245
- if ( $( '#wpglobus-'+api.clone_id ).length > 0 ) {
246
- // WPGlobus element exists already
247
- return;
248
- }
249
- if ( $( nodeName+'[name="wpglobus-'+name+'"]' ).length > 0 ) {
250
- // WPGlobus element exists already
251
- return;
252
- }
253
-
254
- clone = $( $element.clone() );
255
- //$element.addClass('hidden');
256
- style = $element.attr('style') || '';
257
- $element.attr( 'style', 'display:none;' );
258
- clone.attr( 'id', 'wpglobus-'+api.clone_id ).attr( 'name', 'wpglobus-'+name );
259
-
260
- /**
261
- * add WPGlobus translatable class
262
- */
263
- clone.addClass( api.trClass );
264
-
265
- if ( option.onChangeClass != '' ) {
266
- /**
267
- * add class to bind 'change' event
268
- */
269
- clone.addClass( option.onChangeClass );
270
- }
271
-
272
- if ( 'id' == api.element_by ) {
273
- clone.attr('data-source-id', id).attr('data-source-name', '').attr('data-source-get-by',api.element_by);
274
- } else {
275
- clone.attr('data-source-id', '').attr('data-source-name', name).attr('data-source-get-by',api.element_by);
276
- }
277
-
278
- if ( 'textarea' == nodeName ) {
279
- v = WPGlobusCore.getTranslations( $element.text() )[WPGlobusCoreData['language']];
280
- clone.text( v );
281
- clone.attr( 'data-nodename', 'textarea' );
282
- if ( '' == option.style ) {
283
- clone.attr( 'style', style + ';width:95%;float:left;' );
284
- } else {
285
- clone.attr( 'style', style + ';' + option.style );
286
- }
287
- } else {
288
- v = WPGlobusCore.getTranslations( $element.val() )[WPGlobusCoreData['language']];
289
- clone.attr( 'value', v );
290
- clone.attr( 'data-nodename', 'input' );
291
- if ( '' != option.style ) {
292
- clone.attr( 'style', style + ';' + option.style );
293
- }
294
- }
295
-
296
- sb = sb.replace(/{{clone_id}}/g, api.clone_id);
297
- if ( 'id' == api.element_by ) {
298
- sb = sb.replace(/{{id}}/g, api.clone_id);
299
- sb = sb.replace(/{{name}}/g, '');
300
- sb = sb.replace(/{{nodename}}/g, '');
301
- } else {
302
- sb = sb.replace(/{{id}}/g, '');
303
- sb = sb.replace(/{{name}}/g, name);
304
- sb = sb.replace(/{{nodename}}/g, nodeName);
305
- }
306
- sb = 'textarea' == nodeName ? sb.replace( '{{style}}', 'float:left;margin-top:0;' ) : sb.replace( '{{style}}', '' );
307
- var startButtonClasses = 'textarea' == nodeName ? api.startButtonClass + ' wpglobus-textarea wpglobus-textarea-'+api.clone_id : api.startButtonClass;
308
- sb = sb.replace( '{{classes}}', startButtonClasses );
309
- sb = option.dialogTitle == '' ? sb.replace('{{title}}', api.dialogTitle) : sb.replace('{{title}}', option.dialogTitle);
310
- sb = option.sbTitle == '' ? sb.replace('{{sbTitle}}', option.sbTitle) : sb.replace('{{sbTitle}}', 'title="'+option.sbTitle+'"');
311
-
312
- $(sb).insertAfter($element);
313
- $(clone).insertAfter($element);
314
-
315
- if ( 'textarea' == nodeName ) {
316
- $('#wpglobus-'+api.clone_id).addClass( 'wpglobus-textarea-'+api.clone_id );
317
- $('.wpglobus-textarea-'+api.clone_id).wrapAll( '<div class="wpglobus-textarea-wrapper" style="'+option.styleTextareaWrapper+'"></div>' );
318
- }
319
-
320
- /**
321
- * Bind change event
322
- */
323
- var selector, ret = false;
324
- if ( option.onChangeClass == '' ) {
325
- selector = '#wpglobus-' + api.clone_id;
326
- } else {
327
- selector = '.' + option.onChangeClass;
328
- var $events = $._data( $( document )[0], 'events' );
329
- if( typeof $events === 'undefined' ){
330
- ret = true;
331
- } else {
332
- if ( typeof $events.change !== 'undefined' ) {
333
- $.each( $events.change, function(i, ev){
334
- if ( ev.selector == selector ) {
335
- ret = true;
336
- return false;
337
- }
338
- });
339
- }
340
- }
341
- }
342
-
343
- if ( ret ) {
344
- /**
345
- * Return because we had bound 'change' event already
346
- */
347
- return;
348
- }
349
-
350
- $( document ).on( 'change', selector, function() {
351
- var $t = $(this),
352
- sid = $t.data( 'source-id' );
353
-
354
- if ( '' == sid ) {
355
- sid = $t.data( 'nodename' ) + '[name="' + $t.data( 'source-name' ) + '"]';
356
- } else {
357
- sid = '#' + sid;
358
- }
359
- $(sid).val( WPGlobusCore.getString( $(sid).val(), $t.val() ) );
360
- });
361
- },
362
- saveDialog: function() {
363
- var s = '', sdl = '', scl = '', $e, val, l;
364
- $('.wpglobus_dialog_textarea').each(function(indx,e){
365
- $e = $(e);
366
- val = $e.val();
367
- l = $e.data('language');
368
- if ( l == WPGlobusAdmin.data.language ) {
369
- scl = val;
370
- }
371
- if ( val != '' ) {
372
- s = s + WPGlobusCore.addLocaleMarks(val,l);
373
- if ( l == WPGlobusCoreData.default_language ) {
374
- sdl = val;
375
- }
376
- }
377
- });
378
- s = s.length == sdl.length + 8 ? sdl : s;
379
- $(api.id).val(s);
380
- s = scl == '' ? sdl : scl;
381
- $(api.wpglobus_id).val(s);
382
- },
383
- dialog : $('#wpglobus-dialog-wrapper').dialog({
384
- autoOpen: false,
385
- //height: 250,
386
- width: 650,
387
- modal: true,
388
- dialogClass: 'wpglobus-dialog',
389
- buttons: [
390
- {
391
- text:'Save',
392
- class: 'wpglobus-button-save',
393
- click:function(){api.saveDialog(); api.dialog.dialog('close');}
394
- },
395
- {
396
- text:'Cancel',
397
- class: 'wpglobus-button-cancel',
398
- click: function(){api.dialog.dialog('close');}
399
- }
400
- ],
401
- open: function() {
402
- var title = api.dialogTitle;
403
- if ( typeof api.attrs.maxlength !== 'undefined' ) {
404
- $('.wpglobus_dialog_textarea').attr('maxlength', api.attrs.maxlength);
405
- title += ' | maxlength='+api.attrs.maxlength;
406
- }
407
- $('.wpglobus-dialog .ui-dialog-title').text(title);
408
- },
409
- close: function() {
410
- api.form[0].reset();
411
- //allFields.removeClass( "ui-state-error" );
412
- }
413
- }),
414
- attachListener : function() {
415
- $(document).on('click', api.option.settingsClass, function() {
416
- if ( $('.wpglobus_dialog_options_wrapper').hasClass('hidden') ) {
417
- $('.wpglobus_dialog_options_wrapper').removeClass('hidden');
418
- } else {
419
- $('.wpglobus_dialog_options_wrapper').addClass('hidden');
420
- }
421
- });
422
- $(document).on('click', '.wpglobus_dialog_option', function(event) {
423
- var $t = $(this), r;
424
- var ob = $t.data('object');
425
- api.order['action'] = 'save_post_meta_settings';
426
- api.order['post_type'] = WPGlobusAdmin.data.post_type;
427
- api.order['checked'] = $t.prop('checked');
428
- api.order['id'] = $t.attr('id');
429
- api.order['meta_key'] = $t.data('meta-key');
430
- r = api.ajax(api.order);
431
- r.done(function (result) {
432
- if ( result.result == 'ok' ) {
433
- if ( result.checked == 'true' ) {
434
- $(ob).removeClass('wpglobus_dialog_start_hidden');
435
- } else {
436
- $(ob).addClass('wpglobus_dialog_start_hidden');
437
- }
438
- }
439
- })
440
- .fail(function (error) {})
441
- .always(function (jqXHR, status){});
442
- });
443
- $(document).on('click', api.option.listenClass, function(e) {
444
- api.element = $(this);
445
- api.id = api.element.data('source-id');
446
- if ( '' == api.id ) {
447
- api.id = api.element.data('nodename') + '[name="'+api.element.data('source-name')+'"]';
448
- api.wpglobus_id = '#wpglobus-'+api.convertToId( api.element.data('source-name') );
449
- } else {
450
- api.wpglobus_id = '#wpglobus-'+api.id;
451
- api.id = '#'+api.id;
452
- }
453
-
454
- api.clicks++;
455
- if ( api.clicks == 1 ) {
456
- setTimeout(function () {
457
- if (api.clicks == 1) {
458
- api.onClick(e);
459
- } else {
460
- var s = $(api.id);
461
- if ( s.hasClass('hidden') ) {
462
- s.removeClass('hidden').attr('style', 'display:block;');
463
- } else {
464
- s.addClass('hidden').attr('style', 'display:none;');
465
- }
466
- }
467
- api.clicks = 0;
468
- }, 200);
469
- }
470
- });
471
- api.form = api.dialog.find('form#wpglobus-dialog-form').on('submit', function( event ) {
472
- event.preventDefault();
473
- api.saveDialog();
474
- });
475
- },
476
- ajax : function(order) {
477
- return $.ajax({type:'POST', url:WPGlobusAdmin.ajaxurl, data:{action:WPGlobusAdmin.process_ajax, order:order}, dataType:'json', async:false});
478
- },
479
- onClick: function(ev) {
480
- if ( typeof(api.element.data('dialog-title')) == 'undefined' || '' == api.element.data('dialog-title') ) {
481
- api.dialogTitle = api.option.dialogTitle;
482
- } else {
483
- api.dialogTitle = api.element.data('dialog-title');
484
- }
485
- if ( typeof api.id !== 'undefined' ) {
486
- api.attrs['maxlength'] = $(api.id).attr('maxlength');
487
- }
488
-
489
- api.source = api.element.data('source-value');
490
- if ( typeof api.source === 'undefined' ) {
491
- api.source = $(api.id).val();
492
- if (api.request == 'ajax') {
493
- // @todo revise ajax action
494
- //api.order['action'] = 'get_translate';
495
- //api.order['source'] = api.source;
496
- //api.ajax(api.order);
497
- } else {
498
- api.value = WPGlobusCore.getTranslations(api.source);
499
- }
500
- }
501
- $.each(api.value, function(l,e){
502
- $('#wpglobus-dialog-'+l).val(e);
503
- });
504
- api.dialog.dialog('open');
505
- }
506
- };
507
-
508
- })(jQuery);
509
-
510
- jQuery(document).ready(function () {
511
- "use strict";
512
- window.WPGlobusAdminApp = (function (WPGlobusAdminApp, $) {
513
- /* Object Constructor
514
- ========================*/
515
- WPGlobusAdminApp.App = function (config) {
516
-
517
- if (window.WPGlobusAdminApp !== undefined) {
518
- return;
519
- }
520
-
521
- this.config = {
522
- debug: false,
523
- version: WPGlobusAdmin.version
524
- };
525
-
526
- this.status = 'ok';
527
-
528
- if ('undefined' === WPGlobusAdmin) {
529
- this.status = 'error';
530
- if (this.config.debug) {
531
- console.log('Error options loading');
532
- }
533
- } else {
534
- if (this.config.debug) {
535
- console.dir(WPGlobusAdmin);
536
- }
537
- }
538
-
539
- this.config.disable_first_language = [
540
- '<div id="disable_first_language" style="display:block;" class="redux-field-errors notice-red">',
541
- '<strong>',
542
- '<span>&nbsp;</span>',
543
- WPGlobusAdmin.i18n.cannot_disable_language,
544
- '</strong>',
545
- '</div>'
546
- ].join('');
547
-
548
- $.extend(this.config, config);
549
-
550
- if ('ok' === this.status) {
551
- this.init();
552
- }
553
- };
554
-
555
- WPGlobusAdminApp.App.prototype = {
556
- $document : $(document),
557
- init: function () {
558
- WPGlobusCoreData.multisite = this.parseBool(WPGlobusCoreData.multisite);
559
- this.admin_init();
560
- $('#content').addClass('wpglobus-editor').attr('data-language',WPGlobusAdmin.data.default_language);
561
- $('textarea[id^=content_]').each(function(i,e){
562
- var l=$(e).attr('id').replace('content_','');
563
- $(e).attr('data-language',l);
564
- });
565
- if ('post.php' === WPGlobusAdmin.page) {
566
- this.post_edit();
567
- this.set_dialog();
568
- if ( typeof WPGlobusAioseop != 'undefined' ) {
569
- WPGlobusAioseop.init();
570
- }
571
- } else if ('menu-edit' === WPGlobusAdmin.page) {
572
- this.nav_menus();
573
- } else if ('taxonomy-edit' === WPGlobusAdmin.page) {
574
- if (WPGlobusAdmin.data.tag_id) {
575
- this.taxonomy_edit();
576
- }
577
- } else if ('taxonomy-quick-edit' === WPGlobusAdmin.page) {
578
- this.quickEdit('taxonomy');
579
- } else if ('edit.php' === WPGlobusAdmin.page) {
580
- this.quickEdit('post');
581
- } else if ('options-general.php' == WPGlobusAdmin.page) {
582
- this.options_general();
583
- } else if ('widgets.php' == WPGlobusAdmin.page) {
584
- WPGlobusWidgets.init();
585
- WPGlobusDialogApp.init({dialogTitle:'Edit text'});
586
- } else if ('wpglobus_options' == WPGlobusAdmin.page) {
587
- this.start();
588
- } else if ('wpglobusAdminCentral' == WPGlobusAdmin.page) {
589
- this.adminCentral();
590
- } else {
591
- // init WPGlobusDialogApp for using in a 3-party plugins
592
- WPGlobusDialogApp.init({customData:WPGlobusCoreData.page_custom_data});
593
- }
594
- },
595
- parseBool: function(b) {
596
- return !(/^(false|0)$/i).test(b) && !!b;
597
- },
598
- getCurrentTab: function() {
599
- return $( '.wpglobus-post-body-tabs-list .ui-tabs-active' ).data( 'language' );
600
- },
601
- admin_init: function () {
602
- var order = $('.wpglobus-addons-group a').data('key');
603
- if ( 'undefined' !== typeof order ) {
604
- if ( window.location.search.indexOf('page=wpglobus_options&tab='+order) >= 0 ) {
605
- if ( WPGlobusCoreData.multisite ) {
606
- window.location = WPGlobusCoreData.pluginInstallLocation.multisite;
607
- } else {
608
- window.location = WPGlobusCoreData.pluginInstallLocation.single;
609
- }
610
- /**
611
- * obsolete from 1.5.9
612
- * @todo remove after testing @see class WPGlobus_Plugin_Install
613
- */
614
- //window.location = 'admin.php?page=wpglobus-addons';
615
- } else {
616
- var addon = $('#toplevel_page_wpglobus_options li').eq(order+1);
617
- if ( WPGlobusCoreData.multisite ) {
618
- $(addon).find('a').attr('href',WPGlobusCoreData.pluginInstallLocation.multisite).attr('onclick',"window.location=jQuery(this).attr('href');return false;");
619
- } else {
620
- $(addon).find('a').attr('href',WPGlobusCoreData.pluginInstallLocation.single).attr('onclick',"window.location=jQuery(this).attr('href');return false;");
621
- }
622
- /**
623
- * obsolete from 1.5.9
624
- * @todo remove after testing @see class WPGlobus_Plugin_Install
625
- */
626
- //$(addon).find('a').attr('href','admin.php?page=wpglobus-addons').attr('onclick',"window.location=jQuery(this).attr('href');return false;");
627
- }
628
- }
629
- },
630
- options_general: function () {
631
- var $bn = $('#blogname'),
632
- $body = $('body');
633
-
634
- $bn.addClass('hidden');
635
- $('#wpglobus-blogname').insertAfter($bn).removeClass('hidden');
636
-
637
- $body.on('blur', '.wpglobus-blogname', function () {
638
- $('.wpglobus-blogname').each( function (i, e) {
639
- var $e = $(e);
640
- $bn.val( WPGlobusCore.getString( $bn.val(), $e.val(), $e.data('language') ) );
641
- });
642
- });
643
-
644
- var $bd = $('#blogdescription');
645
- $bd.addClass('hidden');
646
- $('#wpglobus-blogdescription').insertAfter($bd).removeClass('hidden');
647
- $body.on('blur', '.wpglobus-blogdesc', function () {
648
- $('.wpglobus-blogdesc').each( function (i, e) {
649
- var $e = $(e);
650
- $bd.val( WPGlobusCore.getString( $bd.val(), $e.val(), $e.data('language') ) );
651
- });
652
- });
653
- },
654
- quickEdit: function (type) {
655
-
656
- /**
657
- * For more info @see ajax handler 'wp_ajax_inline_save'
658
- */
659
- if (typeof WPGlobusAdmin.data.has_items === 'undefined') {
660
- return;
661
- }
662
- if (!WPGlobusAdmin.data.has_items) {
663
- return;
664
- }
665
- var full_id = '', id = 0;
666
-
667
- $(document).ajaxComplete(function(event, jqxhr, settings){
668
- if (typeof settings.data === 'undefined') {
669
- return;
670
- }
671
- if ( full_id == '' ) {
672
- return;
673
- }
674
- if (settings.data.indexOf('action=inline-save-tax&') >= 0) {
675
- $('#'+full_id+' a.row-title').text(WPGlobusAdmin.qedit_titles[id][WPGlobusAdmin.data.language]['name']);
676
- $('#'+full_id+' .description').text(WPGlobusAdmin.qedit_titles[id][WPGlobusAdmin.data.language]['description']);
677
- }
678
- });
679
-
680
- var title = {};
681
- $('#the-list tr').each(function (i, e) {
682
- var $e = $(e);
683
- var k = ( type === 'post' ? 'post-' : 'tag-' );
684
- id = $e.attr('id').replace(k, ''); /* don't need var with id, see line 109 */
685
- title[id] = {};
686
- if ('post' === type) {
687
- title[id]['source'] = $e.find('.post_title').text();
688
- } else if ('taxonomy' === type) {
689
- title[id]['source'] = $('#inline_' + id + ' .name').text();
690
- }
691
- });
692
-
693
- var order = {};
694
- order['action'] = 'get_titles';
695
- order['type'] = type;
696
- order['taxonomy'] = typeof WPGlobusAdmin.data.taxonomy === 'undefined' ? false : WPGlobusAdmin.data.taxonomy;
697
- order['title'] = title;
698
- $.ajax({type:'POST', url:WPGlobusAdmin.ajaxurl, data:{action:WPGlobusAdmin.process_ajax, order:order}, dataType:'json'})
699
- .done(function (result) {
700
- WPGlobusAdmin.qedit_titles = result.qedit_titles;
701
- $.each(result.bulkedit_post_titles, function(id, obj){
702
- $('#inline_'+id+' .post_title').text(obj[WPGlobusAdmin.data.language]['name']);
703
- });
704
- })
705
- .fail(function (error) {
706
- })
707
- .always(function (jqXHR, status) {
708
- });
709
-
710
- $('body').on('change', '.wpglobus-quick-edit-title', function () {
711
- var s = '';
712
- var lang = [];
713
- $('.wpglobus-quick-edit-title').each(function (index, e) {
714
- var $e = $(e);
715
- var l = $e.data('language');
716
- if ($e.val() !== '') {
717
- s = WPGlobusCore.getString( s, $e.val(), l );
718
- }
719
- WPGlobusAdmin.qedit_titles[ id ][ l ][ 'name' ] = $e.val();
720
- lang[ index ] = l;
721
- });
722
-
723
- var so = $(document).triggerHandler( 'wpglobus_get_translations', {string:s, lang:lang, id:id} );
724
- if ( typeof so !== 'undefined' ) {
725
- s = so;
726
- }
727
- // $( 'input.ptitle' ).eq( 0 ).val( s ); // @todo remove after test
728
- $( 'input.ptitle' ).eq( 0 ).attr( 'value', s ) ;
729
- WPGlobusAdmin.qedit_titles[ id ][ 'source' ] = s;
730
- });
731
-
732
- if ( typeof WPGlobusAdmin.data.tags !== 'undefined' ) {
733
- $.each( WPGlobusAdmin.data.tags, function(i,tag){
734
- WPGlobusAdmin.data.value[tag]['post_id'] = {};
735
- });
736
- }
737
-
738
- $('button.save, input#bulk_edit').on('mouseenter', function (event) {
739
- /**
740
- * Quick edit action for the "Tags" box in edit.php page.
741
- */
742
- if ( typeof WPGlobusAdmin.data.tags === 'undefined' ) {
743
- return;
744
- }
745
-
746
- if (event.currentTarget.id=='bulk_edit') {
747
- $('input#bulk_edit').unbind('click');
748
- } else {
749
- $('button.save').unbind('click');
750
- }
751
-
752
- $( 'button.save, input#bulk_edit').on('click', function (event) {
753
- console.log( 'Start Updating' );
754
- var promise = $.when();
755
-
756
- var tagsHandler = function( $elem ) {
757
- $elem.next('.spinner').css({'visibility':'visible'});
758
- if (event.currentTarget.id != 'bulk_edit') {
759
- $.ajaxSetup({async:false});
760
- }
761
- var p = $elem.parents('tr');
762
- var id = p.attr('id').replace('edit-','');
763
- var t,v,newTags;
764
-
765
- $.each( WPGlobusAdmin.data.tags, function(index,tag){
766
- t = p.find("textarea[name='" + WPGlobusAdmin.data.names[tag] + "']");
767
- if ( t.length == 0 ) {
768
- return true;
769
- }
770
- WPGlobusAdmin.data.value[tag]['post_id'][id] = t.val();
771
- v = WPGlobusAdmin.data.value[tag]['post_id'][id].split(',');
772
- newTags = [];
773
- for(var i=0; i<v.length; i++) {
774
- v[i] = v[i].trim(' ');
775
- if ( v[i] != '' ) {
776
- if ( typeof WPGlobusAdmin.data.tag[tag][v[i]] === 'undefined' ) {
777
- newTags[i] = v[i];
778
- } else {
779
- newTags[i] = WPGlobusAdmin.data.tag[tag][v[i]];
780
- }
781
- }
782
- }
783
- t.val( newTags.join(', ') );
784
- });
785
- }
786
-
787
- var $this = $(this);
788
- var start = $.Deferred();
789
- start.resolve( tagsHandler( $(this) ) );
790
-
791
- promise = promise.then(function() {
792
- return $.when(
793
- start.done()
794
- )
795
- }).then( function() {
796
- if (event.currentTarget.id != 'bulk_edit') {
797
- setTimeout(
798
- function() {
799
- inlineEditPost.save(id);
800
- $.ajaxSetup({async:true});
801
- },
802
- 50
803
- );
804
- }
805
- });
806
-
807
- });
808
- });
809
-
810
- $( '#the-list' ).on( 'click', 'a.editinline', function () {
811
- var t = $(this);
812
- full_id = t.parents('tr').attr('id');
813
- if ('post' === type) {
814
- id = full_id.replace('post-', '');
815
- } else if ('taxonomy' === type) {
816
- id = full_id.replace('tag-', '');
817
- } else {
818
- return;
819
- }
820
-
821
- if ( 'post' === type && 'undefined' !== typeof WPGlobusAdmin.data.tags ) {
822
- /**
823
- * @since 1.6.6
824
- */
825
- $.each( WPGlobusAdmin.data.tags, function(i,tag){
826
- if ( WPGlobusAdmin.data.value[tag] != '' ) {
827
- var val = $('#edit-' + id + ' textarea[name="' + WPGlobusAdmin.data.names[tag] + '"]').val(),
828
- currentTags;
829
- if ( 'undefined' !== typeof val ) {
830
- currentTags = val.split(',');
831
- $.each( currentTags, function(order,currentTag) {
832
- val = val.replace(currentTag, WPGlobusCore.TextFilter(currentTag, WPGlobusCoreData.language));
833
- });
834
- $('#edit-' + id + ' textarea[name="' + WPGlobusAdmin.data.names[tag] + '"]').val(val);
835
- }
836
- }
837
- });
838
- }
839
-
840
- var e = $('#edit-' + id + ' input.ptitle').eq(0);
841
- var p = e.parents('label');
842
- e.val(WPGlobusAdmin.qedit_titles[id].source);
843
- e.addClass('hidden');
844
- $(WPGlobusAdmin.data.template).insertAfter(p);
845
-
846
- if ( typeof WPGlobusAdmin.qedit_titles[id] === 'undefined' ) {
847
- WPGlobusAdmin.qedit_titles[id] = {};
848
- WPGlobusAdmin.qedit_titles[id]['source'] = $('#'+full_id+' .name a.row-title').text();
849
- $(WPGlobusAdmin.data.enabled_languages).each(function(i,l){
850
- WPGlobusAdmin.qedit_titles[id][l] = {};
851
- if ( l == WPGlobusAdmin.data.default_language ) {
852
- WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id]['source'];
853
- } else {
854
- WPGlobusAdmin.qedit_titles[id][l]['name'] = '';
855
- }
856
- WPGlobusAdmin.qedit_titles[id][l]['description'] = '';
857
- });
858
- }
859
-
860
- $( '.wpglobus-quick-edit-title' ).each(function ( i, e ) {
861
- var $e = $(e);
862
- var l = $e.data( 'language' );
863
- $e.attr( 'id', l + id );
864
- if ( typeof WPGlobusAdmin.qedit_titles[id][l] !== 'undefined' ) {
865
- WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id][l]['name'].replace( /\\\'/g, "'" );
866
- WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id][l]['name'].replace( /\\\"/g, '"' );
867
- $e.attr( 'value', WPGlobusAdmin.qedit_titles[id][l]['name'] );
868
- WPGlobusAdmin.qedit_titles[id]['source'] =
869
- WPGlobusCore.getString(
870
- WPGlobusAdmin.qedit_titles[id]['source'],
871
- WPGlobusAdmin.qedit_titles[id][l]['name'],
872
- l
873
- );
874
- }
875
- });
876
- // $( 'input.ptitle' ).eq( 0 ).val( WPGlobusAdmin.qedit_titles[ id ][ 'source' ] ); // @todo remove after test
877
- $( 'input.ptitle' ).eq( 0 ).attr( 'value', WPGlobusAdmin.qedit_titles[ id ][ 'source' ] );
878
- });
879
-
880
- },
881
- taxonomy_edit: function () {
882
-
883
- var elements = [];
884
- elements[0] = 'name';
885
- elements[1] = 'description';
886
-
887
- var make_clone = function(id,language){
888
- var $element = $('#'+id),
889
- clone = $element.clone(),
890
- name = $element.attr('name'),
891
- classes = 'wpglobus-element wpglobus-element_'+id+' wpglobus-element_'+language+' wpglobus-translatable',
892
- node;
893
-
894
- node = document.getElementById(id);
895
- node = node.nodeName;
896
- $(clone).attr('id', id+'_'+language);
897
- $(clone).attr('name', name+'_'+language);
898
- if ( language !== WPGlobusCoreData.default_language ) {
899
- classes += ' hidden';
900
- }
901
- $(clone).attr('class', classes);
902
- $(clone).attr('data-save-to', id);
903
- $(clone).attr('data-language', language);
904
- if ( node == 'INPUT' ) {
905
- $(clone).attr('value', $('#wpglobus-link-tab-'+language).data(id));
906
- } else if ( node == 'TEXTAREA' ) {
907
- $(clone).text($('#wpglobus-link-tab-'+language).data(id));
908
- }
909
- $element.addClass('hidden');
910
- if ( $('.wpglobus-element_'+id).size() == 0 ) {
911
- $(clone).insertAfter($element);
912
- } else {
913
- $(clone).insertAfter($('.wpglobus-element_'+id).last());
914
- }
915
- };
916
-
917
- $.each(WPGlobusCoreData.enabled_languages, function(i,l){
918
- $.each(elements, function(i,e){
919
- make_clone(e,l);
920
- });
921
- });
922
-
923
- $('.wpglobus-taxonomy-tabs').insertAfter('#ajax-response');
924
-
925
- // Make class wrap as tabs container
926
- // tabs on
927
- $('.wrap').tabs();
928
-
929
- $('body').on('click', '.wpglobus-taxonomy-tabs li', function(event){
930
- var $t = $(this);
931
- var language = $t.data('language');
932
- $('.wpglobus-element').addClass('hidden');
933
- $('.wpglobus-element_'+language).removeClass('hidden');
934
- });
935
-
936
- $('.wpglobus-element').on('change', function () {
937
- var $this = $(this),
938
- save_to = $this.data('save-to'),
939
- s = '';
940
-
941
- $('.wpglobus-element').each(function (index, element) {
942
- var $e = $(element),
943
- value = $e.val();
944
- if ( $e.data('save-to') == save_to && value !== '' ) {
945
- s = s + WPGlobusCore.addLocaleMarks(value, $e.data('language') )
946
- }
947
- });
948
- $('#' + save_to).val(s);
949
- });
950
- },
951
- nav_menus: function () {
952
- var iID, menu_size,
953
- menu_item = '#menu-to-edit .menu-item';
954
-
955
- var timer = function () {
956
- if (menu_size !== $(menu_item).size()) {
957
- clearInterval(iID);
958
- $(menu_item).each(function (index, li) {
959
- var $li = $(li);
960
- if ($li.hasClass('wpglobus-menu-item')) {
961
- return; // the same as continue
962
- }
963
- var id = $(li).attr('id');
964
- $.each(['input.edit-menu-item-title', 'input.edit-menu-item-attr-title'], function (input_index, input) {
965
- var i = $('#' + id + ' ' + input);
966
- var $i = $(i);
967
- if (!$i.hasClass('wpglobus-hidden')) {
968
- $i.addClass('wpglobus-hidden');
969
- $i.css('display', 'none');
970
- var l = $i.parent('label');
971
- var p = $i.parents('p');
972
- $(p).css('height', '80px');
973
- $(l).append('<div style="color:#f00;">' + WPGlobusAdmin.i18n.save_nav_menu + '</div>');
974
- }
975
- });
976
- $li.addClass('wpglobus-menu-item');
977
- });
978
- }
979
- };
980
-
981
- $.ajaxSetup({
982
- beforeSend: function (jqXHR, PlainObject) {
983
- if (typeof PlainObject.data === 'undefined') {
984
- return;
985
- }
986
- if (PlainObject.data.indexOf('action=add-menu-item') >= 0) {
987
- menu_size = $(menu_item).size();
988
- iID = setInterval(timer, 500);
989
- }
990
- }
991
- });
992
-
993
- $(menu_item).each(function (index, li) {
994
-
995
- var id = $(li).attr('id'),
996
- item_id = id.replace('menu-item-', '');
997
-
998
- $.each(['input.edit-menu-item-title', 'input.edit-menu-item-attr-title'], function (input_index, input) {
999
- var $i = $('#' + id + ' ' + input);
1000
- if ( $i.val() != WPGlobusAdmin.data.items[ item_id ][ input ][ 'source' ] ) {
1001
- /**
1002
- * fix for case when value resets by WP core
1003
- */
1004
- $i.val( WPGlobusAdmin.data.items[ item_id ][ input ][ 'source' ] );
1005
- }
1006
-
1007
- var p = $( '#' + id + ' ' + input ).parents('p');
1008
- var height = 0;
1009
-
1010
- $.each(WPGlobusAdmin.data.open_languages, function (index, language) {
1011
- var new_element = $i.clone();
1012
- new_element.attr('id', $i.attr('id') + '-' + language);
1013
- new_element.attr('name', $i.attr('id') + '-' + language);
1014
- new_element.attr('data-language', language);
1015
- new_element.attr('data-item-id', item_id);
1016
- new_element.attr('placeholder', WPGlobusAdmin.data.en_language_name[language]);
1017
-
1018
- var classes = WPGlobusAdmin.data.items[item_id][language][input]['class'];
1019
- if (input_index === 0 && language === WPGlobusAdmin.data.default_language) {
1020
- new_element.attr('class', classes + ' edit-menu-item-title');
1021
- } else {
1022
- new_element.attr('class', classes);
1023
- }
1024
-
1025
- if ( WPGlobusAdmin.data.items[ item_id ][ language ][ input ][ 'caption' ] != '' ) {
1026
- new_element.attr('value', WPGlobusAdmin.data.items[item_id][language][input]['caption']);
1027
- } else {
1028
- new_element.attr('value', '');
1029
- }
1030
- new_element.css('margin-bottom', '0.6em');
1031
- $(p).append( new_element );
1032
- height = index;
1033
- });
1034
- height = (height + 1) * 40;
1035
- $i.css('display', 'none').attr('class', '').addClass('widefat wpglobus-hidden');
1036
- $(p).css('height', height + 'px').addClass('wpglobus-menu-item-box');
1037
-
1038
- });
1039
- $(li).addClass('wpglobus-menu-item');
1040
- });
1041
-
1042
- $('.menus-move-left, .menus-move-right').each(function(index,e) {
1043
- var $e = $(e), new_title;
1044
- var item_id = $e.parents('li').attr('id').replace('menu-item-', '');
1045
- var title = $e.attr('title');
1046
- if ( typeof title !== 'undefined' ) {
1047
- $.each(WPGlobusAdmin.data.post_titles, function(post_title, item_title) {
1048
- if ( title.indexOf(post_title) >= 0 ) {
1049
- new_title = title.replace(post_title, item_title);
1050
- $e.attr('title', new_title);
1051
- $e.text(new_title);
1052
- }
1053
- });
1054
- }
1055
- });
1056
-
1057
- // Run the item handle title when the navigation label was loaded.
1058
- // @see wp-admin\js\nav-menu.js:537
1059
- $('.edit-menu-item-title').trigger('change');
1060
- wpNavMenu.refreshAdvancedAccessibility();
1061
- wpNavMenu.menusChanged = false;
1062
-
1063
- $('.wpglobus-menu-item').on('change', function () {
1064
- var $this = $(this),
1065
- item_id = $this.data('item-id'),
1066
- s, so;
1067
- if ($this.hasClass('wpglobus-item-title')) {
1068
- s = WPGlobusCore.getString( $('input#edit-menu-item-title-' + item_id).val(), $this.val(), $this.data('language') );
1069
- so = $(document).triggerHandler('wpglobus_get_menu_translations', {string:s, lang:WPGlobusCoreData.open_languages, id:item_id, type:'input.edit-menu-item-title'});
1070
- if ( typeof so !== 'undefined' ) {
1071
- s = so;
1072
- }
1073
- $('input#edit-menu-item-title-' + item_id).val(s);
1074
- }
1075
- if ($this.hasClass('wpglobus-item-attr')) {
1076
- s = WPGlobusCore.getString( $('input#edit-menu-item-attr-title-' + item_id).val(), $this.val(), $this.data('language') );
1077
- so = $(document).triggerHandler('wpglobus_get_menu_translations', {string:s, lang:WPGlobusCoreData.open_languages, id:item_id, type:'input.edit-menu-item-attr-title'});
1078
- if ( typeof so !== 'undefined' ) {
1079
- s = so;
1080
- }
1081
- $('input#edit-menu-item-attr-title-' + item_id).val(s);
1082
- }
1083
-
1084
- });
1085
- },
1086
- post_edit: function () {
1087
- // Hook into the heartbeat-send
1088
- $(document).on('heartbeat-send', function(e, data) {
1089
- if ( typeof data['wp_autosave'] !== 'undefined' ) {
1090
- data['wpglobus_heartbeat'] = 'wpglobus';
1091
- $.each(WPGlobusAdmin.data.open_languages, function(i,l){
1092
- var v = $('#title_'+l).val() || '';
1093
- v = $.trim(v);
1094
- if ( v != '' ) {
1095
- data['wp_autosave']['post_title_'+l] = v;
1096
- }
1097
- v = $('#content_'+l).val() || '';
1098
- v = $.trim(v);
1099
- if ( v != '' ) {
1100
- data['wp_autosave']['content_'+l] = v;
1101
- }
1102
- });
1103
- }
1104
- });
1105
-
1106
- var wrap_at = '#postdivrich',
1107
- set_title = true,
1108
- content_tabs_id = '#post-body-content';
1109
- if ( WPGlobusAdmin.data.support['editor'] === false ) {
1110
- wrap_at = '#titlediv';
1111
- set_title = false;
1112
- }
1113
- if ( WPGlobusAdmin.data.support['title'] === false ) {
1114
- set_title = false;
1115
- }
1116
- // Make post-body-content as tabs container
1117
- $(content_tabs_id).prepend($('.wpglobus-post-body-tabs-list'));
1118
- $.each(WPGlobusAdmin.tabs, function (index, suffix) {
1119
- if ('default' === suffix) {
1120
- $(wrap_at).wrap('<div id="tab-default"></div>');
1121
- if ( set_title ) {
1122
- $($('#titlediv')).insertBefore(wrap_at);
1123
- }
1124
- } else {
1125
- $(wrap_at+'-' + suffix).wrap('<div id="tab-' + suffix + '"></div>');
1126
- if ( set_title ) {
1127
- $($('#titlediv-' + suffix)).insertBefore(wrap_at+'-' + suffix);
1128
- }
1129
- }
1130
- });
1131
-
1132
- // tabs on
1133
- $(content_tabs_id).addClass('wpglobus-post-body-tabs').tabs({
1134
- beforeActivate: function( event, ui ){
1135
- var otab = ui.oldTab[0].id.replace('link-tab-','');
1136
- var ntab = ui.newTab[0].id.replace('link-tab-','');
1137
- if ( 'default' == otab ) {
1138
- otab = WPGlobusCoreData.default_language;
1139
- }
1140
- if ( 'default' == ntab ) {
1141
- ntab = WPGlobusCoreData.default_language;
1142
- }
1143
- var a = $(document).triggerHandler('wpglobus_post_body_tabs', [ otab, ntab ]);
1144
- if ( a || typeof a === 'undefined' ) {
1145
- return true;
1146
- }
1147
- return false;
1148
- }
1149
- }); // #post-body-content
1150
-
1151
- // setup for default language
1152
- $('#title').val(WPGlobusAdmin.title);
1153
-
1154
- /**
1155
- * See other places with the same bookmark.
1156
- * @bookmark EDITOR_LINE_BREAKS
1157
- */
1158
- //$('#content').text(WPGlobusAdmin.content.replace(/\n/g, "<p>"));
1159
-
1160
- $('#content').text(WPGlobusAdmin.content);
1161
-
1162
- if (typeof WPGlobusVendor !== "undefined" && WPGlobusVendor.vendor.WPSEO ) {
1163
- if ( typeof wpglobus_wpseo !== "undefined" ) {
1164
- wpglobus_wpseo();
1165
- } else if ( typeof WPGlobusYoastSeo !== "undefined" ) {
1166
- /** since Yoast SEO 3.0 */
1167
- WPGlobusYoastSeo.init();
1168
- }
1169
- }
1170
-
1171
- if ( WPGlobusAdmin.data.modify_excerpt ) {
1172
- /**
1173
- * Add excerpt fields from template.
1174
- */
1175
- var $excerpt = $( '#excerpt' );
1176
- $excerpt.addClass( 'hidden' ).css( {'display':'none'} );
1177
- $( WPGlobusAdmin.data.template ).insertAfter( $excerpt );
1178
- $( 'body' ).on( 'change', '.wpglobus-excerpt', function () {
1179
- var $t = $( this );
1180
- $excerpt.val( WPGlobusCore.getString( $excerpt.val(), $t.val(), $t.data('language') ) );
1181
- });
1182
- }
1183
-
1184
- /** wp_editor word count */
1185
- if ( typeof wp.utils !== 'undefined' && typeof wp.utils.WordCounter !== 'undefined' ) {
1186
- /** from WordPress 4.3 @see \wp-admin\js\post.js */
1187
- WPGlobusCoreData.wordCounter = {};
1188
-
1189
- var self = this;
1190
-
1191
- $.each( WPGlobusCoreData.enabled_languages, function( i, l ){
1192
- if ( l == WPGlobusCoreData.default_language ) {
1193
- return true;
1194
- }
1195
-
1196
- ( function( $, counter, l ) {
1197
- WPGlobusCoreData.wordCounter[ l ] = {};
1198
- WPGlobusCoreData.wordCounter[ l ][ 'counter' ] = counter;
1199
-
1200
- $( function() {
1201
-
1202
- WPGlobusCoreData.wordCounter[ l ][ 'content' ] = $( '#content_'+l );
1203
- WPGlobusCoreData.wordCounter[ l ][ 'count' ] = $( '#wp-word-count-'+l ).find( '.word-count-'+l );
1204
-
1205
- WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] = 0;
1206
-
1207
- function update( l ) {
1208
- var text, count;
1209
-
1210
- if ( typeof l === 'object' ) {
1211
-
1212
- if ( l == 'tinymce' ) {
1213
- /** wysiwyg editor */
1214
- l = self.getCurrentTab();
1215
- } else {
1216
- /** textarea */
1217
- l = l.target.id.replace( 'content_', '' );
1218
- }
1219
-
1220
- }
1221
-
1222
- if ( typeof WPGlobusCoreData.wordCounter[ l ] === 'undefined' ) {
1223
- return;
1224
- }
1225
-
1226
- //if ( ! contentEditor || contentEditor.isHidden() ) {
1227
- if ( ! WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ] ||
1228
- WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ].isHidden() ) {
1229
-
1230
- text = WPGlobusCoreData.wordCounter[ l ][ 'content' ].val();
1231
-
1232
- } else {
1233
- //text = contentEditor.getContent( { format: 'raw' } );
1234
- text = WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ].getContent( { format: 'raw' } );
1235
- }
1236
-
1237
- //count = counter.count( text );
1238
- count = WPGlobusCoreData.wordCounter[ l ][ 'counter' ].count( text );
1239
-
1240
- //if ( count !== prevCount ) {
1241
- if ( count !== WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] ) {
1242
- //$count.text( count );
1243
- WPGlobusCoreData.wordCounter[ l ][ 'count' ].text( count );
1244
- }
1245
-
1246
- //prevCount = count;
1247
- WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] = count;
1248
- }
1249
-
1250
- $( document ).on( 'tinymce-editor-init', function( event, editor ) {
1251
-
1252
- if ( -1 == editor.id.indexOf( 'content_' ) ) {
1253
- return;
1254
- }
1255
- var l = editor.id.replace( 'content_', '' );
1256
-
1257
- WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ] = editor;
1258
-
1259
- editor.on( 'nodechange keyup', _.debounce( update, 1000 ) );
1260
- } );
1261
-
1262
- WPGlobusCoreData.wordCounter[l]['content'].on( 'input keyup', _.debounce( update, 1000 ) );
1263
-
1264
- update( l );
1265
-
1266
- } );
1267
- } )( jQuery, new wp.utils.WordCounter(), l );
1268
- });
1269
-
1270
- }
1271
-
1272
- if ( typeof(wpWordCount) !== 'undefined' ) {
1273
- // wordpress 4.2.4 and earlier
1274
- var last = 0,
1275
- ls = WPGlobusCoreData.open_languages,
1276
- $d = this.$document,
1277
- lsb = {};
1278
-
1279
- ls.shift();
1280
-
1281
- $.each(WPGlobusCoreData.open_languages, function(i,e){
1282
- lsb[e] = 0;
1283
- });
1284
-
1285
- var wpglobusWordCount = {
1286
- settings : {
1287
- strip : /<[a-zA-Z\/][^<>]*>/g, // strip HTML tags
1288
- clean : /[0-9.(),;:!?%#$¿'"_+=\\/-]+/g, // regexp to remove punctuation, etc.
1289
- w : /\S\s+/g, // word-counting regexp
1290
- c : /\S/g // char-counting regexp for asian languages
1291
- },
1292
- block : lsb,
1293
- wc : function(tx, l, type) {
1294
- var t = this, w, tc = 0;
1295
-
1296
- if ( l == WPGlobusCoreData.default_language ) {
1297
- w = $('.word-count');
1298
- } else {
1299
- w = $('.word-count-'+l);
1300
- }
1301
-
1302
- if ( type === undefined )
1303
- type = wordCountL10n.type;
1304
- if ( type !== 'w' && type !== 'c' )
1305
- type = 'w';
1306
-
1307
- if ( t.block[l] )
1308
- return;
1309
-
1310
- t.block[l] = 1;
1311
-
1312
- setTimeout( function() {
1313
- if ( tx ) {
1314
- tx = tx.replace( t.settings.strip, ' ' ).replace( /&nbsp;|&#160;/gi, ' ' );
1315
- tx = tx.replace( t.settings.clean, '' );
1316
- tx.replace( t.settings[type], function(){tc++;} );
1317
- }
1318
- w.html(tc.toString());
1319
- setTimeout( function() { t.block[l] = 0; }, 2000 );
1320
- }, 1 );
1321
- }
1322
- };
1323
-
1324
- $d.bind( 'wpglobuscountwords', function(e, txt, l) {
1325
- wpglobusWordCount.wc(txt, l);
1326
- });
1327
-
1328
- $.each(ls, function(i,l){
1329
- var co = $('#content_'+l);
1330
- $d.triggerHandler('wpglobuscountwords', [ co.val(), l ]);
1331
- co.keyup( function(e) {
1332
- var k = e.keyCode || e.charCode;
1333
-
1334
- if ( k == last ) {
1335
- return true;
1336
- }
1337
- if ( 13 == k || 8 == last || 46 == last )
1338
- $d.triggerHandler('wpglobuscountwords', [ co.val(), l ]);
1339
-
1340
- last = k;
1341
- return true;
1342
- });
1343
- });
1344
- // word recount for default language
1345
- $(document).triggerHandler('wpglobuscountwords', [ $('#content').val(), WPGlobusCoreData.default_language ]);
1346
- }
1347
- // end word count
1348
-
1349
- $('body').on('click', '#publish, #save-post', function() {
1350
- if ( WPGlobusAdmin.data.open_languages.length > 1 ) {
1351
- $(document).triggerHandler('wpglobus_before_save_post', {content_tabs_id:content_tabs_id});
1352
- // if empty title in default language make it from another titles
1353
- var t = $('#title').val(),
1354
- index, title = '', delimiter = '';
1355
-
1356
- if ( t.length == 0 ) {
1357
- index = WPGlobusAdmin.data.open_languages.indexOf(WPGlobusAdmin.data.default_language);
1358
- WPGlobusAdmin.data.open_languages.splice(index, 1);
1359
- $(WPGlobusAdmin.data.open_languages).each(function(i,l){
1360
- delimiter = i == 0 ? '' : '-';
1361
- t = $('#title_'+l).val();
1362
- if ( t.length > 0 ) {
1363
- if ( title.length == 0 ) { delimiter = '';}
1364
- title = title + delimiter + t;
1365
- }
1366
- });
1367
- }
1368
- if ( title.length > 0 ) {
1369
- $('#title').val(title);
1370
- }
1371
- }
1372
- if ( typeof WPGlobusAdmin.data.tagsdiv === 'undefined' || WPGlobusAdmin.data.tagsdiv.length < 1 ) {
1373
- return;
1374
- }
1375
- $(WPGlobusAdmin.data.tagsdiv).each(function(i,tagsdiv){
1376
- if ($('#' + tagsdiv).size() == 0) {
1377
- /* next iteration */
1378
- return true;
1379
- }
1380
-
1381
- var id = tagsdiv.replace('tagsdiv-', '');
1382
- if ( 'undefined' === id ) {
1383
- return true;
1384
- }
1385
- if ( $('#tax-input-'+id).size() == 0 ) {
1386
- return true;
1387
- }
1388
-
1389
- var name, tags = [];
1390
-
1391
- $('#tagsdiv-'+id+' .tagchecklist span').each(function(i,e){
1392
- name = $(e).text();
1393
- name = name.replace('X', '').trim(' ');
1394
- if ( typeof WPGlobusAdmin.data.tag[id][name] === 'undefined' ) {
1395
- tags[i] = name;
1396
- } else {
1397
- tags[i] = WPGlobusAdmin.data.tag[id][name];
1398
- }
1399
- });
1400
- $('#tax-input-'+id).val(tags.join(', '));
1401
- });
1402
-
1403
- });
1404
-
1405
- $('.ui-state-default').on('click', function () {
1406
- if ('link-tab-default' === $(this).attr('id')) {
1407
- $(window).scrollTop($(window).scrollTop() + 1);
1408
- $(window).scrollTop($(window).scrollTop() - 1);
1409
- }
1410
- });
1411
-
1412
- },
1413
- adminCentral: function () {
1414
- $( '.wpglobus-admin-central-tab' ).css({ 'display':'none' });
1415
-
1416
- if ( $( '.nav-tab-active' ).length > 1 ) {
1417
- $( '.wpglobus-about-wrap .nav-tab-wrapper a' ).removeClass( 'nav-tab-active' );
1418
- }
1419
-
1420
- var setFirstElement = true;
1421
- if ( 0 == location.hash.indexOf( '#' ) ) {
1422
- $( '.wpglobus-about-wrap .nav-tab-wrapper a').each( function( i, e ) {
1423
- if ( $(e).attr( 'href' ) == location.hash ) {
1424
- setFirstElement = false;
1425
- $(e).addClass( 'nav-tab-active' );
1426
- }
1427
- });
1428
- }
1429
- if ( setFirstElement ) {
1430
- $( '.wpglobus-about-wrap .nav-tab-wrapper a' ).eq(0).addClass( 'nav-tab-active' );
1431
- }
1432
-
1433
- var activePanel = $( '.wpglobus-about-wrap .nav-tab-active' ).data( 'tab-id' );
1434
- if ( '' != activePanel ) {
1435
- $( '#'+activePanel ).css({'display':'block'});
1436
- }
1437
-
1438
- $( document ).on( 'click', '.wpglobus-about-wrap .nav-tab', function(event){
1439
- var $t = $( this );
1440
- if ( $t.hasClass( 'nav-tab-active' ) ) {
1441
- return;
1442
- }
1443
- $( '.wpglobus-admin-central-tab' ).css({ 'display':'none' });
1444
- $( '.wpglobus-about-wrap .nav-tab' ).removeClass( 'nav-tab-active' );
1445
- $t.addClass( 'nav-tab-active' );
1446
- if ( '' != $t.data( 'tab-id' ) ) {
1447
- $( '#' + $t.data( 'tab-id' ) ).css({ 'display':'block' });
1448
- }
1449
- });
1450
- },
1451
- start: function () {
1452
- var t = this;
1453
- $('#wpglobus_flags').select2({
1454
- formatResult: this.format,
1455
- formatSelection: this.format,
1456
- minimumResultsForSearch: -1,
1457
- escapeMarkup: function (m) {
1458
- return m;
1459
- }
1460
- });
1461
-
1462
- /** disable checked off first language */
1463
- $('body').on('click', '#enabled_languages-list li:first input', function (event) {
1464
- event.preventDefault();
1465
- $('.redux-save-warn').css({'display': 'none'});
1466
- $('#enabled_languages-list').find('li:first > input').val('1');
1467
- if ($('#disable_first_language').length === 0) {
1468
- $(t.config.disable_first_language).insertAfter('#info_bar');
1469
- }
1470
- return false;
1471
- });
1472
-
1473
- },
1474
- format: function (language) {
1475
- return '<img class="wpglobus_flag" src="' + WPGlobusAdmin.flag_url + language.text + '"/>&nbsp;&nbsp;' + language.text;
1476
- },
1477
- set_dialog: function() {
1478
-
1479
- if ( 'undefined' !== typeof WPGlobusAdmin.data.customFieldsEnabled ) {
1480
- WPGlobusAdmin.data.customFieldsEnabled = this.parseBool( WPGlobusAdmin.data.customFieldsEnabled );
1481
- if ( ! WPGlobusAdmin.data.customFieldsEnabled ) {
1482
- return;
1483
- }
1484
- }
1485
-
1486
- var ajaxify_row_id, added_control = false;
1487
- var add_elements = function(post_id) {
1488
-
1489
- var id, rows, cb, _cb,
1490
- _classes = 'wpglobus_dialog_start wpglobus_dialog_icon';
1491
-
1492
- _cb = [
1493
- '<div class="wpglobus_dialog_options_wrapper hidden">',
1494
- '<input style="width:initial;" id="wpglobus-cb-{{id}}" data-object="#wpglobus-dialog-start-{{id}}" data-meta-key="{{meta-key}}" class="wpglobus_dialog_option wpglobus_dialog_cb" type="checkbox" {{checked}} />',
1495
- '</div>'
1496
- ].join('');
1497
-
1498
- if (typeof post_id == 'undefined') {
1499
- rows = '#the-list tr';
1500
- } else {
1501
- rows = '#the-list tr#'+post_id;
1502
- }
1503
- $(rows).each(function(){
1504
- var $t = $(this),
1505
- tid = $t.attr('id'),
1506
- element = $t.find('textarea'),
1507
- clone, name, meta_key,
1508
- classes = _classes;
1509
-
1510
- id = element.attr('id');
1511
- if ( undefined === id ) {
1512
- return true;
1513
- }
1514
- meta_key = $('#'+tid+'-key').val();
1515
- clone = $('#'+id).clone();
1516
- $(element).addClass('wpglobus-dialog-field-source hidden');
1517
- name = element.attr('name');
1518
- $(clone).attr('id', 'wpglobus-'+id);
1519
- $(clone).attr('name', 'wpglobus-'+name);
1520
- $(clone).attr('data-source-id', id);
1521
- $(clone).attr('class', 'wpglobus-dialog-field');
1522
- $(clone).val( WPGlobusCore.TextFilter($(element).val(), WPGlobusCoreData.language) );
1523
- $(clone).insertAfter(element);
1524
- cb = _cb.replace(/{{id}}/g, id);
1525
- cb = cb.replace(/{{meta-key}}/g, meta_key);
1526
- if ( undefined === WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type] ) {
1527
- cb = cb.replace(/{{checked}}/, 'checked');
1528
- } else {
1529
- if ( undefined !== WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][meta_key] && WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][meta_key] == 'false' ) {
1530
- cb = cb.replace(/{{checked}}/, '');
1531
- classes = _classes+' wpglobus_dialog_start_hidden';
1532
- } else {
1533
- cb = cb.replace(/{{checked}}/, 'checked');
1534
- classes = _classes;
1535
- }
1536
- }
1537
- $t.append('<td style="width:20px;"><div id="wpglobus-dialog-start-'+id+'" data-type="control" data-source-type="textarea" data-source-id="'+id+'" class="'+classes+'"></div>'+cb+'</td>');
1538
- });
1539
- if ( ! added_control && $('#list-table .wpglobus_dialog_start').length > 0 ) {
1540
- $('#list-table thead tr').append('<th class="wpglobus-control-head"><div class="wpglobus_dialog_settings wpglobus_dialog_icon"></div></th>');
1541
- added_control = true;
1542
- }
1543
- }
1544
-
1545
- add_elements();
1546
-
1547
- $('body').on('change', '.wpglobus-dialog-field', function(){
1548
- var $t = $(this),
1549
- source_id = '#'+$t.data('source-id'),
1550
- source = '', s = '', new_value;
1551
-
1552
- if ( typeof source_id == 'undefined' ) {
1553
- return;
1554
- }
1555
- source = $(source_id).val();
1556
-
1557
- if ( ! /(\{:|\[:|<!--:)[a-z]{2}/.test(source) ) {
1558
- $(source_id).val($t.val());
1559
- } else {
1560
- $.each(WPGlobusCoreData.enabled_languages, function(i,l){
1561
- if ( l == WPGlobusCoreData.language ) {
1562
- new_value = $t.val();
1563
- } else {
1564
- new_value = WPGlobusCore.TextFilter(source,l,'RETURN_EMPTY');
1565
- }
1566
- if ( '' != new_value ) {
1567
- s = s + WPGlobusCore.addLocaleMarks(new_value,l);
1568
- }
1569
- });
1570
- $(source_id).val(s);
1571
- }
1572
-
1573
- });
1574
-
1575
- $(document).ajaxSend(function(event, jqxhr, settings){
1576
- if ( 'add-meta' == settings.action ) {
1577
- ajaxify_row_id = settings.element;
1578
- }
1579
- });
1580
- $(document).ajaxComplete(function(event, jqxhr, settings){
1581
- if ( 'add-meta' == settings.action && undefined !== jqxhr.responseXML ) {
1582
- if ( 'newmeta' == ajaxify_row_id ) {
1583
- add_elements('meta-'+$(jqxhr.responseXML.documentElement.outerHTML).find('meta').attr('id'));
1584
- } else {
1585
- add_elements(ajaxify_row_id);
1586
- }
1587
- }
1588
- });
1589
-
1590
- WPGlobusDialogApp.init({dialogTitle:'Edit meta'});
1591
-
1592
- }
1593
- };
1594
-
1595
- new WPGlobusAdminApp.App();
1596
-
1597
- return WPGlobusAdminApp;
1598
-
1599
- }(window.WPGlobusAdminApp || {}, jQuery));
1600
-
1601
- });
1
+ /**
2
+ * WPGlobus Administration Core, Dialog, Admin
3
+ * Interface JS functions
4
+ *
5
+ * @since 1.0.0
6
+ *
7
+ * @package WPGlobus
8
+ * @subpackage Administration
9
+ */
10
+ /*jslint browser: true*/
11
+ /*global jQuery, console, WPGlobusCore, WPGlobusDialogApp, WPGlobusAdmin, inlineEditPost */
12
+
13
+ var WPGlobusCore;
14
+
15
+ (function($) {
16
+ var api;
17
+ api = WPGlobusCore = {
18
+ strpos: function( haystack, needle, offset){
19
+ haystack = "" + haystack;
20
+ var i = haystack.indexOf( needle, offset );
21
+ return i >= 0 ? i : false;
22
+ },
23
+
24
+ TextFilter: function(text, language, return_in){
25
+ if ( typeof text == 'undefined' || '' === text ) { return text; }
26
+
27
+ var pos_start, pos_end, possible_delimiters = [], is_local_text_found = false;;
28
+
29
+ language = '' == language ? 'en' : language;
30
+ return_in = typeof return_in == 'undefined' || '' == return_in ? 'RETURN_IN_DEFAULT_LANGUAGE' : return_in;
31
+
32
+ possible_delimiters[0] = [];
33
+ possible_delimiters[0]['start'] = WPGlobusCoreData.locale_tag_start.replace('%s', language);
34
+ possible_delimiters[0]['end'] = WPGlobusCoreData.locale_tag_end;
35
+
36
+ possible_delimiters[1] = [];
37
+ possible_delimiters[1]['start'] = '<!--:'+language+'-->';
38
+ possible_delimiters[1]['end'] = '<!--:-->';
39
+
40
+ possible_delimiters[2] = [];
41
+ possible_delimiters[2]['start'] = '[:'+language+']';
42
+ possible_delimiters[2]['end'] = '[:';
43
+
44
+
45
+
46
+ for (var i = 0; i < 3; i++) {
47
+
48
+ pos_start = api.strpos( text, possible_delimiters[i]['start'] );
49
+ if ( pos_start === false ) {
50
+ continue;
51
+ }
52
+
53
+ pos_start = pos_start + possible_delimiters[i]['start'].length;
54
+
55
+ pos_end = api.strpos( text, possible_delimiters[i]['end'], pos_start );
56
+
57
+ if ( pos_end === false ) {
58
+ text = text.substr( pos_start );
59
+ } else {
60
+ text = text.substr( pos_start, pos_end - pos_start );
61
+ }
62
+
63
+ is_local_text_found = true;
64
+ break;
65
+
66
+ }
67
+
68
+ if ( ! is_local_text_found ) {
69
+ if ( return_in == 'RETURN_EMPTY' ) {
70
+ if ( language == WPGlobusCoreData.default_language && ! /(\{:|\[:|<!--:)[a-z]{2}/.test(text) ) {
71
+ //
72
+ } else {
73
+ text = '';
74
+ }
75
+ } else {
76
+ // Try RETURN_IN_DEFAULT_LANGUAGE
77
+ if ( language == WPGlobusCoreData.default_language ) {
78
+ if ( /(\{:|\[:|<!--:)[a-z]{2}/.test(text) ) {
79
+ text = '';
80
+ }
81
+ } else {
82
+ text = api.TextFilter( text, WPGlobusCoreData.default_language );
83
+ }
84
+ }
85
+ }
86
+ return text;
87
+ },
88
+ addLocaleMarks: function(text, language) {
89
+ return WPGlobusCoreData.locale_tag_start.replace('%s', language) + text + WPGlobusCoreData.locale_tag_end;
90
+ },
91
+ getTranslations: function(text) {
92
+ var t = {},
93
+ return_in;
94
+ $.each(WPGlobusCoreData.enabled_languages, function(i,l){
95
+ return_in = l == WPGlobusCoreData.default_language ? 'RETURN_IN_DEFAULT_LANGUAGE' : 'RETURN_EMPTY';
96
+ t[l] = api.TextFilter(text, l, return_in);
97
+ });
98
+ return t;
99
+ },
100
+ getString: function(s, newVal, l) {
101
+ if ( 'undefined' === typeof(s) ) {
102
+ return s;
103
+ }
104
+ if ( 'undefined' === typeof(newVal) ) {
105
+ newVal = '';
106
+ }
107
+ if ( 'undefined' === typeof(l) ) {
108
+ l = WPGlobusCoreData.language;
109
+ }
110
+
111
+ s = api.getTranslations(s);
112
+ s[l] = newVal;
113
+
114
+ var cS = '';
115
+
116
+ $.each(s, function(ln,val){
117
+ if ( '' != val && ln != WPGlobusCoreData.default_language) {
118
+ cS += api.addLocaleMarks(val, ln);
119
+ }
120
+ });
121
+
122
+ if ( '' != s[WPGlobusCoreData.default_language] ) {
123
+ if ( '' == cS ) {
124
+ cS = s[WPGlobusCoreData.default_language];
125
+ } else {
126
+ cS = api.addLocaleMarks(s[WPGlobusCoreData.default_language], WPGlobusCoreData.default_language) + cS;
127
+ }
128
+ }
129
+ return cS;
130
+ }
131
+ };
132
+ })(jQuery);
133
+
134
+ var WPGlobusDialogApp;
135
+
136
+ (function($) {
137
+
138
+ var api;
139
+ api = WPGlobusDialogApp = {
140
+ option : {
141
+ listenClass : '.wpglobus_dialog_start',
142
+ settingsClass : '.wpglobus_dialog_settings',
143
+ dialogTabs: '#wpglobus-dialog-tabs',
144
+ dialogTitle: '',
145
+ customData: null,
146
+ callback: function(){}
147
+ },
148
+ form : undefined,
149
+ element : undefined,
150
+ element_by : 'id',
151
+ id : '',
152
+ clone_id: '',
153
+ wpglobus_id : '',
154
+ type : 'textarea',
155
+ source : '',
156
+ order : {},
157
+ value : {},
158
+ request : 'core',
159
+ attrs: {},
160
+ dialogTitle: '',
161
+ trClass: 'wpglobus-translatable',
162
+ startButton: [
163
+ '<span id="wpglobus-dialog-start-{{clone_id}}" ',
164
+ 'style="{{style}}" ',
165
+ 'data-type="control" data-dialog-title="{{title}}" ',
166
+ 'data-source-type="" data-source-id="{{id}}" data-source-name="{{name}}" ',
167
+ 'data-nodename="{{nodename}}"',
168
+ '{{sbTitle}} ',
169
+ 'class="{{classes}}"></span>'
170
+ ].join(''),
171
+ startButtonClass : 'wpglobus_dialog_start wpglobus_dialog_icon',
172
+ clicks: 0,
173
+ init: function(args) {
174
+ api.option = $.extend(api.option, args);
175
+ $(api.option.dialogTabs).tabs();
176
+ api.dialogTitle = api.option.dialogTitle;
177
+ this.attachListener();
178
+ if ( api.option.customData != null && typeof api.option.customData.addElements != 'undefined' ) {
179
+ $.each(api.option.customData.addElements, function(i,e) {
180
+ api.addElement(e);
181
+ });
182
+ }
183
+ },
184
+ convertToId: function(s){
185
+ s = s.replace(/\]/g,'');
186
+ s = s.replace(/\[/g,'-');
187
+ return s;
188
+ },
189
+ addElement: function(elem) {
190
+ var option = {
191
+ id: null,
192
+ dialogTitle: '',
193
+ style: '',
194
+ styleTextareaWrapper: '',
195
+ sbTitle: '',
196
+ onChangeClass: ''
197
+ }
198
+ if ( 'string' == typeof(elem) ) {
199
+ option.id = elem;
200
+ } else if ( 'object' == typeof(elem) ) {
201
+ option = $.extend(option, elem);
202
+ } else {
203
+ return;
204
+ }
205
+
206
+ var $element = null, id = null, name = null, node = null,
207
+ sb = api.startButton,
208
+ clone, v, style, nodeName = '';
209
+
210
+ api.element_by = 'id';
211
+
212
+ node = document.getElementById(option.id);
213
+ if ( null === node ) {
214
+ api.element_by = 'name';
215
+ node = document.getElementsByName(option.id);
216
+ } else {
217
+ nodeName = node.nodeName;
218
+ nodeName = nodeName.toLowerCase();
219
+ }
220
+ if ( 0 == node.length ) {
221
+ return;
222
+ } else {
223
+ id = option.id;
224
+ if ( 'id' == api.element_by ) {
225
+ $element = $('#'+id);
226
+ } else {
227
+ nodeName = node[0].nodeName;
228
+ nodeName = nodeName.toLowerCase();
229
+ $element = $(nodeName+'[name="'+id+'"]');
230
+ }
231
+ }
232
+
233
+ if ( 'undefined' === $element.attr('name') ) {
234
+ name = id;
235
+ } else {
236
+ name = $element.attr('name');
237
+ }
238
+ api.clone_id = api.convertToId(id);
239
+
240
+ if ( -1 != name.indexOf( 'wpglobus' ) || -1 != api.clone_id.indexOf( 'wpglobus' ) ) {
241
+ /* prevent add element to itself */
242
+ return;
243
+ }
244
+
245
+ if ( $( '#wpglobus-'+api.clone_id ).length > 0 ) {
246
+ // WPGlobus element exists already
247
+ return;
248
+ }
249
+ if ( $( nodeName+'[name="wpglobus-'+name+'"]' ).length > 0 ) {
250
+ // WPGlobus element exists already
251
+ return;
252
+ }
253
+
254
+ clone = $( $element.clone() );
255
+ //$element.addClass('hidden');
256
+ style = $element.attr('style') || '';
257
+ $element.attr( 'style', 'display:none;' );
258
+ clone.attr( 'id', 'wpglobus-'+api.clone_id ).attr( 'name', 'wpglobus-'+name );
259
+
260
+ /**
261
+ * add WPGlobus translatable class
262
+ */
263
+ clone.addClass( api.trClass );
264
+
265
+ if ( option.onChangeClass != '' ) {
266
+ /**
267
+ * add class to bind 'change' event
268
+ */
269
+ clone.addClass( option.onChangeClass );
270
+ }
271
+
272
+ if ( 'id' == api.element_by ) {
273
+ clone.attr('data-source-id', id).attr('data-source-name', '').attr('data-source-get-by',api.element_by);
274
+ } else {
275
+ clone.attr('data-source-id', '').attr('data-source-name', name).attr('data-source-get-by',api.element_by);
276
+ }
277
+
278
+ if ( 'textarea' == nodeName ) {
279
+ v = WPGlobusCore.getTranslations( $element.text() )[WPGlobusCoreData['language']];
280
+ clone.text( v );
281
+ clone.attr( 'data-nodename', 'textarea' );
282
+ if ( '' == option.style ) {
283
+ clone.attr( 'style', style + ';width:95%;float:left;' );
284
+ } else {
285
+ clone.attr( 'style', style + ';' + option.style );
286
+ }
287
+ } else {
288
+ v = WPGlobusCore.getTranslations( $element.val() )[WPGlobusCoreData['language']];
289
+ clone.attr( 'value', v );
290
+ clone.attr( 'data-nodename', 'input' );
291
+ if ( '' != option.style ) {
292
+ clone.attr( 'style', style + ';' + option.style );
293
+ }
294
+ }
295
+
296
+ sb = sb.replace(/{{clone_id}}/g, api.clone_id);
297
+ if ( 'id' == api.element_by ) {
298
+ sb = sb.replace(/{{id}}/g, api.clone_id);
299
+ sb = sb.replace(/{{name}}/g, '');
300
+ sb = sb.replace(/{{nodename}}/g, '');
301
+ } else {
302
+ sb = sb.replace(/{{id}}/g, '');
303
+ sb = sb.replace(/{{name}}/g, name);
304
+ sb = sb.replace(/{{nodename}}/g, nodeName);
305
+ }
306
+ sb = 'textarea' == nodeName ? sb.replace( '{{style}}', 'float:left;margin-top:0;' ) : sb.replace( '{{style}}', '' );
307
+ var startButtonClasses = 'textarea' == nodeName ? api.startButtonClass + ' wpglobus-textarea wpglobus-textarea-'+api.clone_id : api.startButtonClass;
308
+ sb = sb.replace( '{{classes}}', startButtonClasses );
309
+ sb = option.dialogTitle == '' ? sb.replace('{{title}}', api.dialogTitle) : sb.replace('{{title}}', option.dialogTitle);
310
+ sb = option.sbTitle == '' ? sb.replace('{{sbTitle}}', option.sbTitle) : sb.replace('{{sbTitle}}', 'title="'+option.sbTitle+'"');
311
+
312
+ $(sb).insertAfter($element);
313
+ $(clone).insertAfter($element);
314
+
315
+ if ( 'textarea' == nodeName ) {
316
+ $('#wpglobus-'+api.clone_id).addClass( 'wpglobus-textarea-'+api.clone_id );
317
+ $('.wpglobus-textarea-'+api.clone_id).wrapAll( '<div class="wpglobus-textarea-wrapper" style="'+option.styleTextareaWrapper+'"></div>' );
318
+ }
319
+
320
+ /**
321
+ * Bind change event
322
+ */
323
+ var selector, ret = false;
324
+ if ( option.onChangeClass == '' ) {
325
+ selector = '#wpglobus-' + api.clone_id;
326
+ } else {
327
+ selector = '.' + option.onChangeClass;
328
+ var $events = $._data( $( document )[0], 'events' );
329
+ if( typeof $events === 'undefined' ){
330
+ ret = true;
331
+ } else {
332
+ if ( typeof $events.change !== 'undefined' ) {
333
+ $.each( $events.change, function(i, ev){
334
+ if ( ev.selector == selector ) {
335
+ ret = true;
336
+ return false;
337
+ }
338
+ });
339
+ }
340
+ }
341
+ }
342
+
343
+ if ( ret ) {
344
+ /**
345
+ * Return because we had bound 'change' event already
346
+ */
347
+ return;
348
+ }
349
+
350
+ $( document ).on( 'change', selector, function() {
351
+ var $t = $(this),
352
+ sid = $t.data( 'source-id' );
353
+
354
+ if ( '' == sid ) {
355
+ sid = $t.data( 'nodename' ) + '[name="' + $t.data( 'source-name' ) + '"]';
356
+ } else {
357
+ sid = '#' + sid;
358
+ }
359
+ $(sid).val( WPGlobusCore.getString( $(sid).val(), $t.val() ) );
360
+ });
361
+ },
362
+ saveDialog: function() {
363
+ var s = '', sdl = '', scl = '', $e, val, l;
364
+ $('.wpglobus_dialog_textarea').each(function(indx,e){
365
+ $e = $(e);
366
+ val = $e.val();
367
+ l = $e.data('language');
368
+ if ( l == WPGlobusAdmin.data.language ) {
369
+ scl = val;
370
+ }
371
+ if ( val != '' ) {
372
+ s = s + WPGlobusCore.addLocaleMarks(val,l);
373
+ if ( l == WPGlobusCoreData.default_language ) {
374
+ sdl = val;
375
+ }
376
+ }
377
+ });
378
+ s = s.length == sdl.length + 8 ? sdl : s;
379
+ $(api.id).val(s);
380
+ s = scl == '' ? sdl : scl;
381
+ $(api.wpglobus_id).val(s);
382
+ },
383
+ dialog : $('#wpglobus-dialog-wrapper').dialog({
384
+ autoOpen: false,
385
+ //height: 250,
386
+ width: 650,
387
+ modal: true,
388
+ dialogClass: 'wpglobus-dialog',
389
+ buttons: [
390
+ {
391
+ text:'Save',
392
+ class: 'wpglobus-button-save',
393
+ click:function(){api.saveDialog(); api.dialog.dialog('close');}
394
+ },
395
+ {
396
+ text:'Cancel',
397
+ class: 'wpglobus-button-cancel',
398
+ click: function(){api.dialog.dialog('close');}
399
+ }
400
+ ],
401
+ open: function() {
402
+ var title = api.dialogTitle;
403
+ if ( typeof api.attrs.maxlength !== 'undefined' ) {
404
+ $('.wpglobus_dialog_textarea').attr('maxlength', api.attrs.maxlength);
405
+ title += ' | maxlength='+api.attrs.maxlength;
406
+ }
407
+ $('.wpglobus-dialog .ui-dialog-title').text(title);
408
+ },
409
+ close: function() {
410
+ api.form[0].reset();
411
+ //allFields.removeClass( "ui-state-error" );
412
+ }
413
+ }),
414
+ attachListener : function() {
415
+ $(document).on('click', api.option.settingsClass, function() {
416
+ if ( $('.wpglobus_dialog_options_wrapper').hasClass('hidden') ) {
417
+ $('.wpglobus_dialog_options_wrapper').removeClass('hidden');
418
+ } else {
419
+ $('.wpglobus_dialog_options_wrapper').addClass('hidden');
420
+ }
421
+ });
422
+ $(document).on('click', '.wpglobus_dialog_option', function(event) {
423
+ var $t = $(this), r;
424
+ var ob = $t.data('object');
425
+ api.order['action'] = 'save_post_meta_settings';
426
+ api.order['post_type'] = WPGlobusAdmin.data.post_type;
427
+ api.order['checked'] = $t.prop('checked');
428
+ api.order['id'] = $t.attr('id');
429
+ api.order['meta_key'] = $t.data('meta-key');
430
+ r = api.ajax(api.order);
431
+ r.done(function (result) {
432
+ if ( result.result == 'ok' ) {
433
+ if ( result.checked == 'true' ) {
434
+ $(ob).removeClass('wpglobus_dialog_start_hidden');
435
+ } else {
436
+ $(ob).addClass('wpglobus_dialog_start_hidden');
437
+ }
438
+ }
439
+ })
440
+ .fail(function (error) {})
441
+ .always(function (jqXHR, status){});
442
+ });
443
+ $(document).on('click', api.option.listenClass, function(e) {
444
+ api.element = $(this);
445
+ api.id = api.element.data('source-id');
446
+ if ( '' == api.id ) {
447
+ api.id = api.element.data('nodename') + '[name="'+api.element.data('source-name')+'"]';
448
+ api.wpglobus_id = '#wpglobus-'+api.convertToId( api.element.data('source-name') );
449
+ } else {
450
+ api.wpglobus_id = '#wpglobus-'+api.id;
451
+ api.id = '#'+api.id;
452
+ }
453
+
454
+ api.clicks++;
455
+ if ( api.clicks == 1 ) {
456
+ setTimeout(function () {
457
+ if (api.clicks == 1) {
458
+ api.onClick(e);
459
+ } else {
460
+ var s = $(api.id);
461
+ if ( s.hasClass('hidden') ) {
462
+ s.removeClass('hidden').attr('style', 'display:block;');
463
+ } else {
464
+ s.addClass('hidden').attr('style', 'display:none;');
465
+ }
466
+ }
467
+ api.clicks = 0;
468
+ }, 200);
469
+ }
470
+ });
471
+ api.form = api.dialog.find('form#wpglobus-dialog-form').on('submit', function( event ) {
472
+ event.preventDefault();
473
+ api.saveDialog();
474
+ });
475
+ },
476
+ ajax : function(order) {
477
+ return $.ajax({type:'POST', url:WPGlobusAdmin.ajaxurl, data:{action:WPGlobusAdmin.process_ajax, order:order}, dataType:'json', async:false});
478
+ },
479
+ onClick: function(ev) {
480
+ if ( typeof(api.element.data('dialog-title')) == 'undefined' || '' == api.element.data('dialog-title') ) {
481
+ api.dialogTitle = api.option.dialogTitle;
482
+ } else {
483
+ api.dialogTitle = api.element.data('dialog-title');
484
+ }
485
+ if ( typeof api.id !== 'undefined' ) {
486
+ api.attrs['maxlength'] = $(api.id).attr('maxlength');
487
+ }
488
+
489
+ api.source = api.element.data('source-value');
490
+ if ( typeof api.source === 'undefined' ) {
491
+ api.source = $(api.id).val();
492
+ if (api.request == 'ajax') {
493
+ // @todo revise ajax action
494
+ //api.order['action'] = 'get_translate';
495
+ //api.order['source'] = api.source;
496
+ //api.ajax(api.order);
497
+ } else {
498
+ api.value = WPGlobusCore.getTranslations(api.source);
499
+ }
500
+ }
501
+ $.each(api.value, function(l,e){
502
+ $('#wpglobus-dialog-'+l).val(e);
503
+ });
504
+ api.dialog.dialog('open');
505
+ }
506
+ };
507
+
508
+ })(jQuery);
509
+
510
+ jQuery(document).ready(function () {
511
+ "use strict";
512
+ window.WPGlobusAdminApp = (function (WPGlobusAdminApp, $) {
513
+ /* Object Constructor
514
+ ========================*/
515
+ WPGlobusAdminApp.App = function (config) {
516
+
517
+ if (window.WPGlobusAdminApp !== undefined) {
518
+ return;
519
+ }
520
+
521
+ this.config = {
522
+ debug: false,
523
+ version: WPGlobusAdmin.version
524
+ };
525
+
526
+ this.status = 'ok';
527
+
528
+ if ('undefined' === WPGlobusAdmin) {
529
+ this.status = 'error';
530
+ if (this.config.debug) {
531
+ console.log('Error options loading');
532
+ }
533
+ } else {
534
+ if (this.config.debug) {
535
+ console.dir(WPGlobusAdmin);
536
+ }
537
+ }
538
+
539
+ this.config.disable_first_language = [
540
+ '<div id="disable_first_language" style="display:block;" class="redux-field-errors notice-red">',
541
+ '<strong>',
542
+ '<span>&nbsp;</span>',
543
+ WPGlobusAdmin.i18n.cannot_disable_language,
544
+ '</strong>',
545
+ '</div>'
546
+ ].join('');
547
+
548
+ $.extend(this.config, config);
549
+
550
+ if ('ok' === this.status) {
551
+ this.init();
552
+ }
553
+ };
554
+
555
+ WPGlobusAdminApp.App.prototype = {
556
+ $document : $(document),
557
+ init: function () {
558
+ WPGlobusCoreData.multisite = this.parseBool(WPGlobusCoreData.multisite);
559
+ this.admin_init();
560
+ $('#content').addClass('wpglobus-editor').attr('data-language',WPGlobusAdmin.data.default_language);
561
+ $('textarea[id^=content_]').each(function(i,e){
562
+ var l=$(e).attr('id').replace('content_','');
563
+ $(e).attr('data-language',l);
564
+ });
565
+ if ('post.php' === WPGlobusAdmin.page) {
566
+ this.post_edit();
567
+ this.set_dialog();
568
+ if ( typeof WPGlobusAioseop != 'undefined' ) {
569
+ WPGlobusAioseop.init();
570
+ }
571
+ } else if ('menu-edit' === WPGlobusAdmin.page) {
572
+ this.nav_menus();
573
+ } else if ('taxonomy-edit' === WPGlobusAdmin.page) {
574
+ if (WPGlobusAdmin.data.tag_id) {
575
+ this.taxonomy_edit();
576
+ }
577
+ } else if ('taxonomy-quick-edit' === WPGlobusAdmin.page) {
578
+ this.quickEdit('taxonomy');
579
+ } else if ('edit.php' === WPGlobusAdmin.page) {
580
+ this.quickEdit('post');
581
+ } else if ('options-general.php' == WPGlobusAdmin.page) {
582
+ this.options_general();
583
+ } else if ('widgets.php' == WPGlobusAdmin.page) {
584
+ WPGlobusWidgets.init();
585
+ WPGlobusDialogApp.init({dialogTitle:'Edit text'});
586
+ } else if ('wpglobus_options' == WPGlobusAdmin.page) {
587
+ this.start();
588
+ } else if ('wpglobusAdminCentral' == WPGlobusAdmin.page) {
589
+ this.adminCentral();
590
+ } else {
591
+ // init WPGlobusDialogApp for using in a 3-party plugins
592
+ WPGlobusDialogApp.init({customData:WPGlobusCoreData.page_custom_data});
593
+ }
594
+ },
595
+ parseBool: function(b) {
596
+ return !(/^(false|0)$/i).test(b) && !!b;
597
+ },
598
+ getCurrentTab: function() {
599
+ return $( '.wpglobus-post-body-tabs-list .ui-tabs-active' ).data( 'language' );
600
+ },
601
+ admin_init: function () {
602
+ var order = $('.wpglobus-addons-group a').data('key');
603
+ if ( 'undefined' !== typeof order ) {
604
+ if ( window.location.search.indexOf('page=wpglobus_options&tab='+order) >= 0 ) {
605
+ if ( WPGlobusCoreData.multisite ) {
606
+ window.location = WPGlobusCoreData.pluginInstallLocation.multisite;
607
+ } else {
608
+ window.location = WPGlobusCoreData.pluginInstallLocation.single;
609
+ }
610
+ /**
611
+ * obsolete from 1.5.9
612
+ * @todo remove after testing @see class WPGlobus_Plugin_Install
613
+ */
614
+ //window.location = 'admin.php?page=wpglobus-addons';
615
+ } else {
616
+ var addon = $('#toplevel_page_wpglobus_options li').eq(order+1);
617
+ if ( WPGlobusCoreData.multisite ) {
618
+ $(addon).find('a').attr('href',WPGlobusCoreData.pluginInstallLocation.multisite).attr('onclick',"window.location=jQuery(this).attr('href');return false;");
619
+ } else {
620
+ $(addon).find('a').attr('href',WPGlobusCoreData.pluginInstallLocation.single).attr('onclick',"window.location=jQuery(this).attr('href');return false;");
621
+ }
622
+ /**
623
+ * obsolete from 1.5.9
624
+ * @todo remove after testing @see class WPGlobus_Plugin_Install
625
+ */
626
+ //$(addon).find('a').attr('href','admin.php?page=wpglobus-addons').attr('onclick',"window.location=jQuery(this).attr('href');return false;");
627
+ }
628
+ }
629
+ },
630
+ options_general: function () {
631
+ var $bn = $('#blogname'),
632
+ $body = $('body');
633
+
634
+ $bn.addClass('hidden');
635
+ $('#wpglobus-blogname').insertAfter($bn).removeClass('hidden');
636
+
637
+ $body.on('blur', '.wpglobus-blogname', function () {
638
+ $('.wpglobus-blogname').each( function (i, e) {
639
+ var $e = $(e);
640
+ $bn.val( WPGlobusCore.getString( $bn.val(), $e.val(), $e.data('language') ) );
641
+ });
642
+ });
643
+
644
+ var $bd = $('#blogdescription');
645
+ $bd.addClass('hidden');
646
+ $('#wpglobus-blogdescription').insertAfter($bd).removeClass('hidden');
647
+ $body.on('blur', '.wpglobus-blogdesc', function () {
648
+ $('.wpglobus-blogdesc').each( function (i, e) {
649
+ var $e = $(e);
650
+ $bd.val( WPGlobusCore.getString( $bd.val(), $e.val(), $e.data('language') ) );
651
+ });
652
+ });
653
+ },
654
+ quickEdit: function (type) {
655
+
656
+ /**
657
+ * For more info @see ajax handler 'wp_ajax_inline_save'
658
+ */
659
+ if (typeof WPGlobusAdmin.data.has_items === 'undefined') {
660
+ return;
661
+ }
662
+ if (!WPGlobusAdmin.data.has_items) {
663
+ return;
664
+ }
665
+ var full_id = '', id = 0;
666
+
667
+ $(document).ajaxComplete(function(event, jqxhr, settings){
668
+ if (typeof settings.data === 'undefined') {
669
+ return;
670
+ }
671
+ if ( full_id == '' ) {
672
+ return;
673
+ }
674
+ if (settings.data.indexOf('action=inline-save-tax&') >= 0) {
675
+ $('#'+full_id+' a.row-title').text(WPGlobusAdmin.qedit_titles[id][WPGlobusAdmin.data.language]['name']);
676
+ $('#'+full_id+' .description').text(WPGlobusAdmin.qedit_titles[id][WPGlobusAdmin.data.language]['description']);
677
+ }
678
+ });
679
+
680
+ var title = {};
681
+ $('#the-list tr').each(function (i, e) {
682
+ var $e = $(e);
683
+ var k = ( type === 'post' ? 'post-' : 'tag-' );
684
+ id = $e.attr('id').replace(k, ''); /* don't need var with id, see line 109 */
685
+ title[id] = {};
686
+ if ('post' === type) {
687
+ title[id]['source'] = $e.find('.post_title').text();
688
+ } else if ('taxonomy' === type) {
689
+ title[id]['source'] = $('#inline_' + id + ' .name').text();
690
+ }
691
+ });
692
+
693
+ var order = {};
694
+ order['action'] = 'get_titles';
695
+ order['type'] = type;
696
+ order['taxonomy'] = typeof WPGlobusAdmin.data.taxonomy === 'undefined' ? false : WPGlobusAdmin.data.taxonomy;
697
+ order['title'] = title;
698
+ $.ajax({type:'POST', url:WPGlobusAdmin.ajaxurl, data:{action:WPGlobusAdmin.process_ajax, order:order}, dataType:'json'})
699
+ .done(function (result) {
700
+ WPGlobusAdmin.qedit_titles = result.qedit_titles;
701
+ $.each(result.bulkedit_post_titles, function(id, obj){
702
+ $('#inline_'+id+' .post_title').text(obj[WPGlobusAdmin.data.language]['name']);
703
+ });
704
+ })
705
+ .fail(function (error) {
706
+ })
707
+ .always(function (jqXHR, status) {
708
+ });
709
+
710
+ $('body').on('change', '.wpglobus-quick-edit-title', function () {
711
+ var s = '';
712
+ var lang = [];
713
+ $('.wpglobus-quick-edit-title').each(function (index, e) {
714
+ var $e = $(e);
715
+ var l = $e.data('language');
716
+ if ($e.val() !== '') {
717
+ s = WPGlobusCore.getString( s, $e.val(), l );
718
+ }
719
+ WPGlobusAdmin.qedit_titles[ id ][ l ][ 'name' ] = $e.val();
720
+ lang[ index ] = l;
721
+ });
722
+
723
+ var so = $(document).triggerHandler( 'wpglobus_get_translations', {string:s, lang:lang, id:id} );
724
+ if ( typeof so !== 'undefined' ) {
725
+ s = so;
726
+ }
727
+ // $( 'input.ptitle' ).eq( 0 ).val( s ); // @todo remove after test
728
+ $( 'input.ptitle' ).eq( 0 ).attr( 'value', s ) ;
729
+ WPGlobusAdmin.qedit_titles[ id ][ 'source' ] = s;
730
+ });
731
+
732
+ if ( typeof WPGlobusAdmin.data.tags !== 'undefined' ) {
733
+ $.each( WPGlobusAdmin.data.tags, function(i,tag){
734
+ WPGlobusAdmin.data.value[tag]['post_id'] = {};
735
+ });
736
+ }
737
+
738
+ $('button.save, input#bulk_edit').on('mouseenter', function (event) {
739
+ /**
740
+ * Quick edit action for the "Tags" box in edit.php page.
741
+ */
742
+ if ( typeof WPGlobusAdmin.data.tags === 'undefined' ) {
743
+ return;
744
+ }
745
+
746
+ if (event.currentTarget.id=='bulk_edit') {
747
+ $('input#bulk_edit').unbind('click');
748
+ } else {
749
+ $('button.save').unbind('click');
750
+ }
751
+
752
+ $( 'button.save, input#bulk_edit').on('click', function (event) {
753
+ console.log( 'Start Updating' );
754
+ var promise = $.when();
755
+
756
+ var tagsHandler = function( $elem ) {
757
+ $elem.next('.spinner').css({'visibility':'visible'});
758
+ if (event.currentTarget.id != 'bulk_edit') {
759
+ $.ajaxSetup({async:false});
760
+ }
761
+ var p = $elem.parents('tr');
762
+ var id = p.attr('id').replace('edit-','');
763
+ var t,v,newTags;
764
+
765
+ $.each( WPGlobusAdmin.data.tags, function(index,tag){
766
+ t = p.find("textarea[name='" + WPGlobusAdmin.data.names[tag] + "']");
767
+ if ( t.length == 0 ) {
768
+ return true;
769
+ }
770
+ WPGlobusAdmin.data.value[tag]['post_id'][id] = t.val();
771
+ v = WPGlobusAdmin.data.value[tag]['post_id'][id].split(',');
772
+ newTags = [];
773
+ for(var i=0; i<v.length; i++) {
774
+ v[i] = v[i].trim(' ');
775
+ if ( v[i] != '' ) {
776
+ if ( typeof WPGlobusAdmin.data.tag[tag][v[i]] === 'undefined' ) {
777
+ newTags[i] = v[i];
778
+ } else {
779
+ newTags[i] = WPGlobusAdmin.data.tag[tag][v[i]];
780
+ }
781
+ }
782
+ }
783
+ t.val( newTags.join(', ') );
784
+ });
785
+ }
786
+
787
+ var $this = $(this);
788
+ var start = $.Deferred();
789
+ start.resolve( tagsHandler( $(this) ) );
790
+
791
+ promise = promise.then(function() {
792
+ return $.when(
793
+ start.done()
794
+ )
795
+ }).then( function() {
796
+ if (event.currentTarget.id != 'bulk_edit') {
797
+ setTimeout(
798
+ function() {
799
+ inlineEditPost.save(id);
800
+ $.ajaxSetup({async:true});
801
+ },
802
+ 50
803
+ );
804
+ }
805
+ });
806
+
807
+ });
808
+ });
809
+
810
+ $( '#the-list' ).on( 'click', 'a.editinline', function () {
811
+ var t = $(this);
812
+ full_id = t.parents('tr').attr('id');
813
+ if ('post' === type) {
814
+ id = full_id.replace('post-', '');
815
+ } else if ('taxonomy' === type) {
816
+ id = full_id.replace('tag-', '');
817
+ } else {
818
+ return;
819
+ }
820
+
821
+ if ( 'post' === type && 'undefined' !== typeof WPGlobusAdmin.data.tags ) {
822
+ /**
823
+ * @since 1.6.6
824
+ */
825
+ $.each( WPGlobusAdmin.data.tags, function(i,tag){
826
+ if ( WPGlobusAdmin.data.value[tag] != '' ) {
827
+ var val = $('#edit-' + id + ' textarea[name="' + WPGlobusAdmin.data.names[tag] + '"]').val(),
828
+ currentTags;
829
+ if ( 'undefined' !== typeof val ) {
830
+ currentTags = val.split(',');
831
+ $.each( currentTags, function(order,currentTag) {
832
+ val = val.replace(currentTag, WPGlobusCore.TextFilter(currentTag, WPGlobusCoreData.language));
833
+ });
834
+ $('#edit-' + id + ' textarea[name="' + WPGlobusAdmin.data.names[tag] + '"]').val(val);
835
+ }
836
+ }
837
+ });
838
+ }
839
+
840
+ var e = $('#edit-' + id + ' input.ptitle').eq(0);
841
+ var p = e.parents('label');
842
+ e.val(WPGlobusAdmin.qedit_titles[id].source);
843
+ e.addClass('hidden');
844
+ $(WPGlobusAdmin.data.template).insertAfter(p);
845
+
846
+ if ( typeof WPGlobusAdmin.qedit_titles[id] === 'undefined' ) {
847
+ WPGlobusAdmin.qedit_titles[id] = {};
848
+ WPGlobusAdmin.qedit_titles[id]['source'] = $('#'+full_id+' .name a.row-title').text();
849
+ $(WPGlobusAdmin.data.enabled_languages).each(function(i,l){
850
+ WPGlobusAdmin.qedit_titles[id][l] = {};
851
+ if ( l == WPGlobusAdmin.data.default_language ) {
852
+ WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id]['source'];
853
+ } else {
854
+ WPGlobusAdmin.qedit_titles[id][l]['name'] = '';
855
+ }
856
+ WPGlobusAdmin.qedit_titles[id][l]['description'] = '';
857
+ });
858
+ }
859
+
860
+ $( '.wpglobus-quick-edit-title' ).each(function ( i, e ) {
861
+ var $e = $(e);
862
+ var l = $e.data( 'language' );
863
+ $e.attr( 'id', l + id );
864
+ if ( typeof WPGlobusAdmin.qedit_titles[id][l] !== 'undefined' ) {
865
+ WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id][l]['name'].replace( /\\\'/g, "'" );
866
+ WPGlobusAdmin.qedit_titles[id][l]['name'] = WPGlobusAdmin.qedit_titles[id][l]['name'].replace( /\\\"/g, '"' );
867
+ $e.attr( 'value', WPGlobusAdmin.qedit_titles[id][l]['name'] );
868
+ WPGlobusAdmin.qedit_titles[id]['source'] =
869
+ WPGlobusCore.getString(
870
+ WPGlobusAdmin.qedit_titles[id]['source'],
871
+ WPGlobusAdmin.qedit_titles[id][l]['name'],
872
+ l
873
+ );
874
+ }
875
+ });
876
+ // $( 'input.ptitle' ).eq( 0 ).val( WPGlobusAdmin.qedit_titles[ id ][ 'source' ] ); // @todo remove after test
877
+ $( 'input.ptitle' ).eq( 0 ).attr( 'value', WPGlobusAdmin.qedit_titles[ id ][ 'source' ] );
878
+ });
879
+
880
+ },
881
+ taxonomy_edit: function () {
882
+
883
+ var elements = [];
884
+ elements[0] = 'name';
885
+ elements[1] = 'description';
886
+
887
+ var make_clone = function(id,language){
888
+ var $element = $('#'+id),
889
+ clone = $element.clone(),
890
+ name = $element.attr('name'),
891
+ classes = 'wpglobus-element wpglobus-element_'+id+' wpglobus-element_'+language+' wpglobus-translatable',
892
+ node;
893
+
894
+ node = document.getElementById(id);
895
+ node = node.nodeName;
896
+ $(clone).attr('id', id+'_'+language);
897
+ $(clone).attr('name', name+'_'+language);
898
+ if ( language !== WPGlobusCoreData.default_language ) {
899
+ classes += ' hidden';
900
+ }
901
+ $(clone).attr('class', classes);
902
+ $(clone).attr('data-save-to', id);
903
+ $(clone).attr('data-language', language);
904
+ if ( node == 'INPUT' ) {
905
+ $(clone).attr('value', $('#wpglobus-link-tab-'+language).data(id));
906
+ } else if ( node == 'TEXTAREA' ) {
907
+ $(clone).text($('#wpglobus-link-tab-'+language).data(id));
908
+ }
909
+ $element.addClass('hidden');
910
+ if ( $('.wpglobus-element_'+id).size() == 0 ) {
911
+ $(clone).insertAfter($element);
912
+ } else {
913
+ $(clone).insertAfter($('.wpglobus-element_'+id).last());
914
+ }
915
+ };
916
+
917
+ $.each(WPGlobusCoreData.enabled_languages, function(i,l){
918
+ $.each(elements, function(i,e){
919
+ make_clone(e,l);
920
+ });
921
+ });
922
+
923
+ $('.wpglobus-taxonomy-tabs').insertAfter('#ajax-response');
924
+
925
+ // Make class wrap as tabs container
926
+ // tabs on
927
+ $('.wrap').tabs();
928
+
929
+ $('body').on('click', '.wpglobus-taxonomy-tabs li', function(event){
930
+ var $t = $(this);
931
+ var language = $t.data('language');
932
+ $('.wpglobus-element').addClass('hidden');
933
+ $('.wpglobus-element_'+language).removeClass('hidden');
934
+ });
935
+
936
+ $('.wpglobus-element').on('change', function () {
937
+ var $this = $(this),
938
+ save_to = $this.data('save-to'),
939
+ s = '';
940
+
941
+ $('.wpglobus-element').each(function (index, element) {
942
+ var $e = $(element),
943
+ value = $e.val();
944
+ if ( $e.data('save-to') == save_to && value !== '' ) {
945
+ s = s + WPGlobusCore.addLocaleMarks(value, $e.data('language') )
946
+ }
947
+ });
948
+ $('#' + save_to).val(s);
949
+ });
950
+ },
951
+ nav_menus: function () {
952
+ var iID, menu_size,
953
+ menu_item = '#menu-to-edit .menu-item';
954
+
955
+ var timer = function () {
956
+ if (menu_size !== $(menu_item).size()) {
957
+ clearInterval(iID);
958
+ $(menu_item).each(function (index, li) {
959
+ var $li = $(li);
960
+ if ($li.hasClass('wpglobus-menu-item')) {
961
+ return; // the same as continue
962
+ }
963
+ var id = $(li).attr('id');
964
+ $.each(['input.edit-menu-item-title', 'input.edit-menu-item-attr-title'], function (input_index, input) {
965
+ var i = $('#' + id + ' ' + input);
966
+ var $i = $(i);
967
+ if (!$i.hasClass('wpglobus-hidden')) {
968
+ $i.addClass('wpglobus-hidden');
969
+ $i.css('display', 'none');
970
+ var l = $i.parent('label');
971
+ var p = $i.parents('p');
972
+ $(p).css('height', '80px');
973
+ $(l).append('<div style="color:#f00;">' + WPGlobusAdmin.i18n.save_nav_menu + '</div>');
974
+ }
975
+ });
976
+ $li.addClass('wpglobus-menu-item');
977
+ });
978
+ }
979
+ };
980
+
981
+ $.ajaxSetup({
982
+ beforeSend: function (jqXHR, PlainObject) {
983
+ if (typeof PlainObject.data === 'undefined') {
984
+ return;
985
+ }
986
+ if (PlainObject.data.indexOf('action=add-menu-item') >= 0) {
987
+ menu_size = $(menu_item).size();
988
+ iID = setInterval(timer, 500);
989
+ }
990
+ }
991
+ });
992
+
993
+ $(menu_item).each(function (index, li) {
994
+
995
+ var id = $(li).attr('id'),
996
+ item_id = id.replace('menu-item-', '');
997
+
998
+ $.each(['input.edit-menu-item-title', 'input.edit-menu-item-attr-title'], function (input_index, input) {
999
+ var $i = $('#' + id + ' ' + input);
1000
+ if ( $i.val() != WPGlobusAdmin.data.items[ item_id ][ input ][ 'source' ] ) {
1001
+ /**
1002
+ * fix for case when value resets by WP core
1003
+ */
1004
+ $i.val( WPGlobusAdmin.data.items[ item_id ][ input ][ 'source' ] );
1005
+ }
1006
+
1007
+ var p = $( '#' + id + ' ' + input ).parents('p');
1008
+ var height = 0;
1009
+
1010
+ $.each(WPGlobusAdmin.data.open_languages, function (index, language) {
1011
+ var new_element = $i.clone();
1012
+ new_element.attr('id', $i.attr('id') + '-' + language);
1013
+ new_element.attr('name', $i.attr('id') + '-' + language);
1014
+ new_element.attr('data-language', language);
1015
+ new_element.attr('data-item-id', item_id);
1016
+ new_element.attr('placeholder', WPGlobusAdmin.data.en_language_name[language]);
1017
+
1018
+ var classes = WPGlobusAdmin.data.items[item_id][language][input]['class'];
1019
+ if (input_index === 0 && language === WPGlobusAdmin.data.default_language) {
1020
+ new_element.attr('class', classes + ' edit-menu-item-title');
1021
+ } else {
1022
+ new_element.attr('class', classes);
1023
+ }
1024
+
1025
+ if ( WPGlobusAdmin.data.items[ item_id ][ language ][ input ][ 'caption' ] != '' ) {
1026
+ new_element.attr('value', WPGlobusAdmin.data.items[item_id][language][input]['caption']);
1027
+ } else {
1028
+ new_element.attr('value', '');
1029
+ }
1030
+ new_element.css('margin-bottom', '0.6em');
1031
+ $(p).append( new_element );
1032
+ height = index;
1033
+ });
1034
+ height = (height + 1) * 40;
1035
+ $i.css('display', 'none').attr('class', '').addClass('widefat wpglobus-hidden');
1036
+ $(p).css('height', height + 'px').addClass('wpglobus-menu-item-box');
1037
+
1038
+ });
1039
+ $(li).addClass('wpglobus-menu-item');
1040
+ });
1041
+
1042
+ $('.menus-move-left, .menus-move-right').each(function(index,e) {
1043
+ var $e = $(e), new_title;
1044
+ var item_id = $e.parents('li').attr('id').replace('menu-item-', '');
1045
+ var title = $e.attr('title');
1046
+ if ( typeof title !== 'undefined' ) {
1047
+ $.each(WPGlobusAdmin.data.post_titles, function(post_title, item_title) {
1048
+ if ( title.indexOf(post_title) >= 0 ) {
1049
+ new_title = title.replace(post_title, item_title);
1050
+ $e.attr('title', new_title);
1051
+ $e.text(new_title);
1052
+ }
1053
+ });
1054
+ }
1055
+ });
1056
+
1057
+ // Run the item handle title when the navigation label was loaded.
1058
+ // @see wp-admin\js\nav-menu.js:537
1059
+ $('.edit-menu-item-title').trigger('change');
1060
+ wpNavMenu.refreshAdvancedAccessibility();
1061
+ wpNavMenu.menusChanged = false;
1062
+
1063
+ $('.wpglobus-menu-item').on('change', function () {
1064
+ var $this = $(this),
1065
+ item_id = $this.data('item-id'),
1066
+ s, so;
1067
+ if ($this.hasClass('wpglobus-item-title')) {
1068
+ s = WPGlobusCore.getString( $('input#edit-menu-item-title-' + item_id).val(), $this.val(), $this.data('language') );
1069
+ so = $(document).triggerHandler('wpglobus_get_menu_translations', {string:s, lang:WPGlobusCoreData.open_languages, id:item_id, type:'input.edit-menu-item-title'});
1070
+ if ( typeof so !== 'undefined' ) {
1071
+ s = so;
1072
+ }
1073
+ $('input#edit-menu-item-title-' + item_id).val(s);
1074
+ }
1075
+ if ($this.hasClass('wpglobus-item-attr')) {
1076
+ s = WPGlobusCore.getString( $('input#edit-menu-item-attr-title-' + item_id).val(), $this.val(), $this.data('language') );
1077
+ so = $(document).triggerHandler('wpglobus_get_menu_translations', {string:s, lang:WPGlobusCoreData.open_languages, id:item_id, type:'input.edit-menu-item-attr-title'});
1078
+ if ( typeof so !== 'undefined' ) {
1079
+ s = so;
1080
+ }
1081
+ $('input#edit-menu-item-attr-title-' + item_id).val(s);
1082
+ }
1083
+
1084
+ });
1085
+ },
1086
+ post_edit: function () {
1087
+ // Hook into the heartbeat-send
1088
+ $(document).on('heartbeat-send', function(e, data) {
1089
+ if ( typeof data['wp_autosave'] !== 'undefined' ) {
1090
+ data['wpglobus_heartbeat'] = 'wpglobus';
1091
+ $.each(WPGlobusAdmin.data.open_languages, function(i,l){
1092
+ var v = $('#title_'+l).val() || '';
1093
+ v = $.trim(v);
1094
+ if ( v != '' ) {
1095
+ data['wp_autosave']['post_title_'+l] = v;
1096
+ }
1097
+ v = $('#content_'+l).val() || '';
1098
+ v = $.trim(v);
1099
+ if ( v != '' ) {
1100
+ data['wp_autosave']['content_'+l] = v;
1101
+ }
1102
+ });
1103
+ }
1104
+ });
1105
+
1106
+ var wrap_at = '#postdivrich',
1107
+ set_title = true,
1108
+ content_tabs_id = '#post-body-content';
1109
+ if ( WPGlobusAdmin.data.support['editor'] === false ) {
1110
+ wrap_at = '#titlediv';
1111
+ set_title = false;
1112
+ }
1113
+ if ( WPGlobusAdmin.data.support['title'] === false ) {
1114
+ set_title = false;
1115
+ }
1116
+ // Make post-body-content as tabs container
1117
+ $(content_tabs_id).prepend($('.wpglobus-post-body-tabs-list'));
1118
+ $.each(WPGlobusAdmin.tabs, function (index, suffix) {
1119
+ if ('default' === suffix) {
1120
+ $(wrap_at).wrap('<div id="tab-default"></div>');
1121
+ if ( set_title ) {
1122
+ $($('#titlediv')).insertBefore(wrap_at);
1123
+ }
1124
+ } else {
1125
+ $(wrap_at+'-' + suffix).wrap('<div id="tab-' + suffix + '"></div>');
1126
+ if ( set_title ) {
1127
+ $($('#titlediv-' + suffix)).insertBefore(wrap_at+'-' + suffix);
1128
+ }
1129
+ }
1130
+ });
1131
+
1132
+ // tabs on
1133
+ $(content_tabs_id).addClass('wpglobus-post-body-tabs').tabs({
1134
+ beforeActivate: function( event, ui ){
1135
+ var otab = ui.oldTab[0].id.replace('link-tab-','');
1136
+ var ntab = ui.newTab[0].id.replace('link-tab-','');
1137
+ if ( 'default' == otab ) {
1138
+ otab = WPGlobusCoreData.default_language;
1139
+ }
1140
+ if ( 'default' == ntab ) {
1141
+ ntab = WPGlobusCoreData.default_language;
1142
+ }
1143
+ var a = $(document).triggerHandler('wpglobus_post_body_tabs', [ otab, ntab ]);
1144
+ if ( a || typeof a === 'undefined' ) {
1145
+ return true;
1146
+ }
1147
+ return false;
1148
+ }
1149
+ }); // #post-body-content
1150
+
1151
+ // setup for default language
1152
+ $('#title').val(WPGlobusAdmin.title);
1153
+
1154
+ /**
1155
+ * See other places with the same bookmark.
1156
+ * @bookmark EDITOR_LINE_BREAKS
1157
+ */
1158
+ //$('#content').text(WPGlobusAdmin.content.replace(/\n/g, "<p>"));
1159
+
1160
+ $('#content').text(WPGlobusAdmin.content);
1161
+
1162
+ if (typeof WPGlobusVendor !== "undefined" && WPGlobusVendor.vendor.WPSEO ) {
1163
+ if ( typeof wpglobus_wpseo !== "undefined" ) {
1164
+ wpglobus_wpseo();
1165
+ } else if ( typeof WPGlobusYoastSeo !== "undefined" ) {
1166
+ /** since Yoast SEO 3.0 */
1167
+ WPGlobusYoastSeo.init();
1168
+ }
1169
+ }
1170
+
1171
+ if ( WPGlobusAdmin.data.modify_excerpt ) {
1172
+ /**
1173
+ * Add excerpt fields from template.
1174
+ */
1175
+ var $excerpt = $( '#excerpt' );
1176
+ $excerpt.addClass( 'hidden' ).css( {'display':'none'} );
1177
+ $( WPGlobusAdmin.data.template ).insertAfter( $excerpt );
1178
+ $( 'body' ).on( 'change', '.wpglobus-excerpt', function () {
1179
+ var $t = $( this );
1180
+ $excerpt.val( WPGlobusCore.getString( $excerpt.val(), $t.val(), $t.data('language') ) );
1181
+ });
1182
+ }
1183
+
1184
+ /** wp_editor word count */
1185
+ if ( typeof wp.utils !== 'undefined' && typeof wp.utils.WordCounter !== 'undefined' ) {
1186
+ /** from WordPress 4.3 @see \wp-admin\js\post.js */
1187
+ WPGlobusCoreData.wordCounter = {};
1188
+
1189
+ var self = this;
1190
+
1191
+ $.each( WPGlobusCoreData.enabled_languages, function( i, l ){
1192
+ if ( l == WPGlobusCoreData.default_language ) {
1193
+ return true;
1194
+ }
1195
+
1196
+ ( function( $, counter, l ) {
1197
+ WPGlobusCoreData.wordCounter[ l ] = {};
1198
+ WPGlobusCoreData.wordCounter[ l ][ 'counter' ] = counter;
1199
+
1200
+ $( function() {
1201
+
1202
+ WPGlobusCoreData.wordCounter[ l ][ 'content' ] = $( '#content_'+l );
1203
+ WPGlobusCoreData.wordCounter[ l ][ 'count' ] = $( '#wp-word-count-'+l ).find( '.word-count-'+l );
1204
+
1205
+ WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] = 0;
1206
+
1207
+ function update( l ) {
1208
+ var text, count;
1209
+
1210
+ if ( typeof l === 'object' ) {
1211
+
1212
+ if ( l == 'tinymce' ) {
1213
+ /** wysiwyg editor */
1214
+ l = self.getCurrentTab();
1215
+ } else {
1216
+ /** textarea */
1217
+ l = l.target.id.replace( 'content_', '' );
1218
+ }
1219
+
1220
+ }
1221
+
1222
+ if ( typeof WPGlobusCoreData.wordCounter[ l ] === 'undefined' ) {
1223
+ return;
1224
+ }
1225
+
1226
+ //if ( ! contentEditor || contentEditor.isHidden() ) {
1227
+ if ( ! WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ] ||
1228
+ WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ].isHidden() ) {
1229
+
1230
+ text = WPGlobusCoreData.wordCounter[ l ][ 'content' ].val();
1231
+
1232
+ } else {
1233
+ //text = contentEditor.getContent( { format: 'raw' } );
1234
+ text = WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ].getContent( { format: 'raw' } );
1235
+ }
1236
+
1237
+ //count = counter.count( text );
1238
+ count = WPGlobusCoreData.wordCounter[ l ][ 'counter' ].count( text );
1239
+
1240
+ //if ( count !== prevCount ) {
1241
+ if ( count !== WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] ) {
1242
+ //$count.text( count );
1243
+ WPGlobusCoreData.wordCounter[ l ][ 'count' ].text( count );
1244
+ }
1245
+
1246
+ //prevCount = count;
1247
+ WPGlobusCoreData.wordCounter[ l ][ 'prevCount' ] = count;
1248
+ }
1249
+
1250
+ $( document ).on( 'tinymce-editor-init', function( event, editor ) {
1251
+
1252
+ if ( -1 == editor.id.indexOf( 'content_' ) ) {
1253
+ return;
1254
+ }
1255
+ var l = editor.id.replace( 'content_', '' );
1256
+
1257
+ WPGlobusCoreData.wordCounter[ l ][ 'contentEditor' ] = editor;
1258
+
1259
+ editor.on( 'nodechange keyup', _.debounce( update, 1000 ) );
1260
+ } );
1261
+
1262
+ WPGlobusCoreData.wordCounter[l]['content'].on( 'input keyup', _.debounce( update, 1000 ) );
1263
+
1264
+ update( l );
1265
+
1266
+ } );
1267
+ } )( jQuery, new wp.utils.WordCounter(), l );
1268
+ });
1269
+
1270
+ }
1271
+
1272
+ if ( typeof(wpWordCount) !== 'undefined' ) {
1273
+ // wordpress 4.2.4 and earlier
1274
+ var last = 0,
1275
+ ls = WPGlobusCoreData.open_languages,
1276
+ $d = this.$document,
1277
+ lsb = {};
1278
+
1279
+ ls.shift();
1280
+
1281
+ $.each(WPGlobusCoreData.open_languages, function(i,e){
1282
+ lsb[e] = 0;
1283
+ });
1284
+
1285
+ var wpglobusWordCount = {
1286
+ settings : {
1287
+ strip : /<[a-zA-Z\/][^<>]*>/g, // strip HTML tags
1288
+ clean : /[0-9.(),;:!?%#$¿'"_+=\\/-]+/g, // regexp to remove punctuation, etc.
1289
+ w : /\S\s+/g, // word-counting regexp
1290
+ c : /\S/g // char-counting regexp for asian languages
1291
+ },
1292
+ block : lsb,
1293
+ wc : function(tx, l, type) {
1294
+ var t = this, w, tc = 0;
1295
+
1296
+ if ( l == WPGlobusCoreData.default_language ) {
1297
+ w = $('.word-count');
1298
+ } else {
1299
+ w = $('.word-count-'+l);
1300
+ }
1301
+
1302
+ if ( type === undefined )
1303
+ type = wordCountL10n.type;
1304
+ if ( type !== 'w' && type !== 'c' )
1305
+ type = 'w';
1306
+
1307
+ if ( t.block[l] )
1308
+ return;
1309
+
1310
+ t.block[l] = 1;
1311
+
1312
+ setTimeout( function() {
1313
+ if ( tx ) {
1314
+ tx = tx.replace( t.settings.strip, ' ' ).replace( /&nbsp;|&#160;/gi, ' ' );
1315
+ tx = tx.replace( t.settings.clean, '' );
1316
+ tx.replace( t.settings[type], function(){tc++;} );
1317
+ }
1318
+ w.html(tc.toString());
1319
+ setTimeout( function() { t.block[l] = 0; }, 2000 );
1320
+ }, 1 );
1321
+ }
1322
+ };
1323
+
1324
+ $d.bind( 'wpglobuscountwords', function(e, txt, l) {
1325
+ wpglobusWordCount.wc(txt, l);
1326
+ });
1327
+
1328
+ $.each(ls, function(i,l){
1329
+ var co = $('#content_'+l);
1330
+ $d.triggerHandler('wpglobuscountwords', [ co.val(), l ]);
1331
+ co.keyup( function(e) {
1332
+ var k = e.keyCode || e.charCode;
1333
+
1334
+ if ( k == last ) {
1335
+ return true;
1336
+ }
1337
+ if ( 13 == k || 8 == last || 46 == last )
1338
+ $d.triggerHandler('wpglobuscountwords', [ co.val(), l ]);
1339
+
1340
+ last = k;
1341
+ return true;
1342
+ });
1343
+ });
1344
+ // word recount for default language
1345
+ $(document).triggerHandler('wpglobuscountwords', [ $('#content').val(), WPGlobusCoreData.default_language ]);
1346
+ }
1347
+ // end word count
1348
+
1349
+ $('body').on('click', '#publish, #save-post', function() {
1350
+ if ( WPGlobusAdmin.data.open_languages.length > 1 ) {
1351
+ $(document).triggerHandler('wpglobus_before_save_post', {content_tabs_id:content_tabs_id});
1352
+ // if empty title in default language make it from another titles
1353
+ var t = $('#title').val(),
1354
+ index, title = '', delimiter = '';
1355
+
1356
+ if ( t.length == 0 ) {
1357
+ index = WPGlobusAdmin.data.open_languages.indexOf(WPGlobusAdmin.data.default_language);
1358
+ WPGlobusAdmin.data.open_languages.splice(index, 1);
1359
+ $(WPGlobusAdmin.data.open_languages).each(function(i,l){
1360
+ delimiter = i == 0 ? '' : '-';
1361
+ t = $('#title_'+l).val();
1362
+ if ( t.length > 0 ) {
1363
+ if ( title.length == 0 ) { delimiter = '';}
1364
+ title = title + delimiter + t;
1365
+ }
1366
+ });
1367
+ }
1368
+ if ( title.length > 0 ) {
1369
+ $('#title').val(title);
1370
+ }
1371
+ }
1372
+ if ( typeof WPGlobusAdmin.data.tagsdiv === 'undefined' || WPGlobusAdmin.data.tagsdiv.length < 1 ) {
1373
+ return;
1374
+ }
1375
+ $(WPGlobusAdmin.data.tagsdiv).each(function(i,tagsdiv){
1376
+ if ($('#' + tagsdiv).size() == 0) {
1377
+ /* next iteration */
1378
+ return true;
1379
+ }
1380
+
1381
+ var id = tagsdiv.replace('tagsdiv-', '');
1382
+ if ( 'undefined' === id ) {
1383
+ return true;
1384
+ }
1385
+ if ( $('#tax-input-'+id).size() == 0 ) {
1386
+ return true;
1387
+ }
1388
+
1389
+ var name, tags = [];
1390
+
1391
+ $('#tagsdiv-'+id+' .tagchecklist span').each(function(i,e){
1392
+ name = $(e).text();
1393
+ name = name.replace('X', '').trim(' ');
1394
+ if ( typeof WPGlobusAdmin.data.tag[id][name] === 'undefined' ) {
1395
+ tags[i] = name;
1396
+ } else {
1397
+ tags[i] = WPGlobusAdmin.data.tag[id][name];
1398
+ }
1399
+ });
1400
+ $('#tax-input-'+id).val(tags.join(', '));
1401
+ });
1402
+
1403
+ });
1404
+
1405
+ $('.ui-state-default').on('click', function () {
1406
+ if ('link-tab-default' === $(this).attr('id')) {
1407
+ $(window).scrollTop($(window).scrollTop() + 1);
1408
+ $(window).scrollTop($(window).scrollTop() - 1);
1409
+ }
1410
+ });
1411
+
1412
+ },
1413
+ adminCentral: function () {
1414
+ $( '.wpglobus-admin-central-tab' ).css({ 'display':'none' });
1415
+
1416
+ if ( $( '.nav-tab-active' ).length > 1 ) {
1417
+ $( '.wpglobus-about-wrap .nav-tab-wrapper a' ).removeClass( 'nav-tab-active' );
1418
+ }
1419
+
1420
+ var setFirstElement = true;
1421
+ if ( 0 == location.hash.indexOf( '#' ) ) {
1422
+ $( '.wpglobus-about-wrap .nav-tab-wrapper a').each( function( i, e ) {
1423
+ if ( $(e).attr( 'href' ) == location.hash ) {
1424
+ setFirstElement = false;
1425
+ $(e).addClass( 'nav-tab-active' );
1426
+ }
1427
+ });
1428
+ }
1429
+ if ( setFirstElement ) {
1430
+ $( '.wpglobus-about-wrap .nav-tab-wrapper a' ).eq(0).addClass( 'nav-tab-active' );
1431
+ }
1432
+
1433
+ var activePanel = $( '.wpglobus-about-wrap .nav-tab-active' ).data( 'tab-id' );
1434
+ if ( '' != activePanel ) {
1435
+ $( '#'+activePanel ).css({'display':'block'});
1436
+ }
1437
+
1438
+ $( document ).on( 'click', '.wpglobus-about-wrap .nav-tab', function(event){
1439
+ var $t = $( this );
1440
+ if ( $t.hasClass( 'nav-tab-active' ) ) {
1441
+ return;
1442
+ }
1443
+ $( '.wpglobus-admin-central-tab' ).css({ 'display':'none' });
1444
+ $( '.wpglobus-about-wrap .nav-tab' ).removeClass( 'nav-tab-active' );
1445
+ $t.addClass( 'nav-tab-active' );
1446
+ if ( '' != $t.data( 'tab-id' ) ) {
1447
+ $( '#' + $t.data( 'tab-id' ) ).css({ 'display':'block' });
1448
+ }
1449
+ });
1450
+ },
1451
+ start: function () {
1452
+ var t = this;
1453
+ $('#wpglobus_flags').select2({
1454
+ formatResult: this.format,
1455
+ formatSelection: this.format,
1456
+ minimumResultsForSearch: -1,
1457
+ escapeMarkup: function (m) {
1458
+ return m;
1459
+ }
1460
+ });
1461
+
1462
+ /** disable checked off first language */
1463
+ $('body').on('click', '#enabled_languages-list li:first input', function (event) {
1464
+ event.preventDefault();
1465
+ $('.redux-save-warn').css({'display': 'none'});
1466
+ $('#enabled_languages-list').find('li:first > input').val('1');
1467
+ if ($('#disable_first_language').length === 0) {
1468
+ $(t.config.disable_first_language).insertAfter('#info_bar');
1469
+ }
1470
+ return false;
1471
+ });
1472
+
1473
+ },
1474
+ format: function (language) {
1475
+ return '<img class="wpglobus_flag" src="' + WPGlobusAdmin.flag_url + language.text + '"/>&nbsp;&nbsp;' + language.text;
1476
+ },
1477
+ set_dialog: function() {
1478
+
1479
+ if ( 'undefined' !== typeof WPGlobusAdmin.data.customFieldsEnabled ) {
1480
+ WPGlobusAdmin.data.customFieldsEnabled = this.parseBool( WPGlobusAdmin.data.customFieldsEnabled );
1481
+ if ( ! WPGlobusAdmin.data.customFieldsEnabled ) {
1482
+ return;
1483
+ }
1484
+ }
1485
+
1486
+ var ajaxify_row_id, added_control = false;
1487
+ var add_elements = function(post_id) {
1488
+
1489
+ var id, rows, cb, _cb,
1490
+ _classes = 'wpglobus_dialog_start wpglobus_dialog_icon';
1491
+
1492
+ _cb = [
1493
+ '<div class="wpglobus_dialog_options_wrapper hidden">',
1494
+ '<input style="width:initial;" id="wpglobus-cb-{{id}}" data-object="#wpglobus-dialog-start-{{id}}" data-meta-key="{{meta-key}}" class="wpglobus_dialog_option wpglobus_dialog_cb" type="checkbox" {{checked}} />',
1495
+ '</div>'
1496
+ ].join('');
1497
+
1498
+ if (typeof post_id == 'undefined') {
1499
+ rows = '#the-list tr';
1500
+ } else {
1501
+ rows = '#the-list tr#'+post_id;
1502
+ }
1503
+ $(rows).each(function(){
1504
+ var $t = $(this),
1505
+ tid = $t.attr('id'),
1506
+ element = $t.find('textarea'),
1507
+ clone, name, meta_key,
1508
+ classes = _classes;
1509
+
1510
+ id = element.attr('id');
1511
+ if ( undefined === id ) {
1512
+ return true;
1513
+ }
1514
+ meta_key = $('#'+tid+'-key').val();
1515
+ clone = $('#'+id).clone();
1516
+ $(element).addClass('wpglobus-dialog-field-source hidden');
1517
+ name = element.attr('name');
1518
+ $(clone).attr('id', 'wpglobus-'+id);
1519
+ $(clone).attr('name', 'wpglobus-'+name);
1520
+ $(clone).attr('data-source-id', id);
1521
+ $(clone).attr('class', 'wpglobus-dialog-field');
1522
+ $(clone).val( WPGlobusCore.TextFilter($(element).val(), WPGlobusCoreData.language) );
1523
+ $(clone).insertAfter(element);
1524
+ cb = _cb.replace(/{{id}}/g, id);
1525
+ cb = cb.replace(/{{meta-key}}/g, meta_key);
1526
+ if ( undefined === WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type] ) {
1527
+ cb = cb.replace(/{{checked}}/, 'checked');
1528
+ } else {
1529
+ if ( undefined !== WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][meta_key] && WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][meta_key] == 'false' ) {
1530
+ cb = cb.replace(/{{checked}}/, '');
1531
+ classes = _classes+' wpglobus_dialog_start_hidden';
1532
+ } else {
1533
+ cb = cb.replace(/{{checked}}/, 'checked');
1534
+ classes = _classes;
1535
+ }
1536
+ }
1537
+ $t.append('<td style="width:20px;"><div id="wpglobus-dialog-start-'+id+'" data-type="control" data-source-type="textarea" data-source-id="'+id+'" class="'+classes+'"></div>'+cb+'</td>');
1538
+ });
1539
+ if ( ! added_control && $('#list-table .wpglobus_dialog_start').length > 0 ) {
1540
+ $('#list-table thead tr').append('<th class="wpglobus-control-head"><div class="wpglobus_dialog_settings wpglobus_dialog_icon"></div></th>');
1541
+ added_control = true;
1542
+ }
1543
+ }
1544
+
1545
+ add_elements();
1546
+
1547
+ $('body').on('change', '.wpglobus-dialog-field', function(){
1548
+ var $t = $(this),
1549
+ source_id = '#'+$t.data('source-id'),
1550
+ source = '', s = '', new_value;
1551
+
1552
+ if ( typeof source_id == 'undefined' ) {
1553
+ return;
1554
+ }
1555
+ source = $(source_id).val();
1556
+
1557
+ if ( ! /(\{:|\[:|<!--:)[a-z]{2}/.test(source) ) {
1558
+ $(source_id).val($t.val());
1559
+ } else {
1560
+ $.each(WPGlobusCoreData.enabled_languages, function(i,l){
1561
+ if ( l == WPGlobusCoreData.language ) {
1562
+ new_value = $t.val();
1563
+ } else {
1564
+ new_value = WPGlobusCore.TextFilter(source,l,'RETURN_EMPTY');
1565
+ }
1566
+ if ( '' != new_value ) {
1567
+ s = s + WPGlobusCore.addLocaleMarks(new_value,l);
1568
+ }
1569
+ });
1570
+ $(source_id).val(s);
1571
+ }
1572
+
1573
+ });
1574
+
1575
+ $(document).ajaxSend(function(event, jqxhr, settings){
1576
+ if ( 'add-meta' == settings.action ) {
1577
+ ajaxify_row_id = settings.element;
1578
+ }
1579
+ });
1580
+ $(document).ajaxComplete(function(event, jqxhr, settings){
1581
+ if ( 'add-meta' == settings.action && undefined !== jqxhr.responseXML ) {
1582
+ if ( 'newmeta' == ajaxify_row_id ) {
1583
+ add_elements('meta-'+$(jqxhr.responseXML.documentElement.outerHTML).find('meta').attr('id'));
1584
+ } else {
1585
+ add_elements(ajaxify_row_id);
1586
+ }
1587
+ }
1588
+ });
1589
+
1590
+ WPGlobusDialogApp.init({dialogTitle:'Edit meta'});
1591
+
1592
+ }
1593
+ };
1594
+
1595
+ new WPGlobusAdminApp.App();
1596
+
1597
+ return WPGlobusAdminApp;
1598
+
1599
+ }(window.WPGlobusAdminApp || {}, jQuery));
1600
+
1601
+ });
includes/js/wpglobus-admin.min.js CHANGED
@@ -1 +1 @@
1
- var WPGlobusCore;!function(t){var a;a=WPGlobusCore={strpos:function(t,a,e){var o=(t=""+t).indexOf(a,e);return o>=0&&o},TextFilter:function(t,e,o){if(void 0===t||""===t)return t;var n,i,l=[],s=!1;e=""==e?"en":e,o=void 0===o||""==o?"RETURN_IN_DEFAULT_LANGUAGE":o,l[0]=[],l[0].start=WPGlobusCoreData.locale_tag_start.replace("%s",e),l[0].end=WPGlobusCoreData.locale_tag_end,l[1]=[],l[1].start="\x3c!--:"+e+"--\x3e",l[1].end="\x3c!--:--\x3e",l[2]=[],l[2].start="[:"+e+"]",l[2].end="[:";for(var d=0;d<3;d++)if(!1!==(n=a.strpos(t,l[d].start))){n+=l[d].start.length,t=!1===(i=a.strpos(t,l[d].end,n))?t.substr(n):t.substr(n,i-n),s=!0;break}return s||("RETURN_EMPTY"==o?(e!=WPGlobusCoreData.default_language||/(\{:|\[:|<!--:)[a-z]{2}/.test(t))&&(t=""):e==WPGlobusCoreData.default_language?/(\{:|\[:|<!--:)[a-z]{2}/.test(t)&&(t=""):t=a.TextFilter(t,WPGlobusCoreData.default_language)),t},addLocaleMarks:function(t,a){return WPGlobusCoreData.locale_tag_start.replace("%s",a)+t+WPGlobusCoreData.locale_tag_end},getTranslations:function(e){var o,n={};return t.each(WPGlobusCoreData.enabled_languages,function(t,i){o=i==WPGlobusCoreData.default_language?"RETURN_IN_DEFAULT_LANGUAGE":"RETURN_EMPTY",n[i]=a.TextFilter(e,i,o)}),n},getString:function(e,o,n){if(void 0===e)return e;void 0===o&&(o=""),void 0===n&&(n=WPGlobusCoreData.language),(e=a.getTranslations(e))[n]=o;var i="";return t.each(e,function(t,e){""!=e&&t!=WPGlobusCoreData.default_language&&(i+=a.addLocaleMarks(e,t))}),""!=e[WPGlobusCoreData.default_language]&&(i=""==i?e[WPGlobusCoreData.default_language]:a.addLocaleMarks(e[WPGlobusCoreData.default_language],WPGlobusCoreData.default_language)+i),i}}}(jQuery);var WPGlobusDialogApp;!function(t){var a;a=WPGlobusDialogApp={option:{listenClass:".wpglobus_dialog_start",settingsClass:".wpglobus_dialog_settings",dialogTabs:"#wpglobus-dialog-tabs",dialogTitle:"",customData:null,callback:function(){}},form:void 0,element:void 0,element_by:"id",id:"",clone_id:"",wpglobus_id:"",type:"textarea",source:"",order:{},value:{},request:"core",attrs:{},dialogTitle:"",trClass:"wpglobus-translatable",startButton:['<span id="wpglobus-dialog-start-{{clone_id}}" ','style="{{style}}" ','data-type="control" data-dialog-title="{{title}}" ','data-source-type="" data-source-id="{{id}}" data-source-name="{{name}}" ','data-nodename="{{nodename}}"',"{{sbTitle}} ",'class="{{classes}}"></span>'].join(""),startButtonClass:"wpglobus_dialog_start wpglobus_dialog_icon",clicks:0,init:function(e){a.option=t.extend(a.option,e),t(a.option.dialogTabs).tabs(),a.dialogTitle=a.option.dialogTitle,this.attachListener(),null!=a.option.customData&&void 0!==a.option.customData.addElements&&t.each(a.option.customData.addElements,function(t,e){a.addElement(e)})},convertToId:function(t){return t=(t=t.replace(/\]/g,"")).replace(/\[/g,"-")},addElement:function(e){var o={id:null,dialogTitle:"",style:"",styleTextareaWrapper:"",sbTitle:"",onChangeClass:""};if("string"==typeof e)o.id=e;else{if("object"!=typeof e)return;o=t.extend(o,e)}var n,i,l,s=null,d=null,u=null,r=null,c=a.startButton,g="";if(a.element_by="id",null===(r=document.getElementById(o.id))?(a.element_by="name",r=document.getElementsByName(o.id)):g=(g=r.nodeName).toLowerCase(),0!=r.length&&(d=o.id,"id"==a.element_by?s=t("#"+d):(g=(g=r[0].nodeName).toLowerCase(),s=t(g+'[name="'+d+'"]')),u="undefined"===s.attr("name")?d:s.attr("name"),a.clone_id=a.convertToId(d),-1==u.indexOf("wpglobus")&&-1==a.clone_id.indexOf("wpglobus")&&!(t("#wpglobus-"+a.clone_id).length>0||t(g+'[name="wpglobus-'+u+'"]').length>0))){n=t(s.clone()),l=s.attr("style")||"",s.attr("style","display:none;"),n.attr("id","wpglobus-"+a.clone_id).attr("name","wpglobus-"+u),n.addClass(a.trClass),""!=o.onChangeClass&&n.addClass(o.onChangeClass),"id"==a.element_by?n.attr("data-source-id",d).attr("data-source-name","").attr("data-source-get-by",a.element_by):n.attr("data-source-id","").attr("data-source-name",u).attr("data-source-get-by",a.element_by),"textarea"==g?(i=WPGlobusCore.getTranslations(s.text())[WPGlobusCoreData.language],n.text(i),n.attr("data-nodename","textarea"),""==o.style?n.attr("style",l+";width:95%;float:left;"):n.attr("style",l+";"+o.style)):(i=WPGlobusCore.getTranslations(s.val())[WPGlobusCoreData.language],n.attr("value",i),n.attr("data-nodename","input"),""!=o.style&&n.attr("style",l+";"+o.style)),c=c.replace(/{{clone_id}}/g,a.clone_id),c="id"==a.element_by?(c=(c=c.replace(/{{id}}/g,a.clone_id)).replace(/{{name}}/g,"")).replace(/{{nodename}}/g,""):(c=(c=c.replace(/{{id}}/g,"")).replace(/{{name}}/g,u)).replace(/{{nodename}}/g,g),c="textarea"==g?c.replace("{{style}}","float:left;margin-top:0;"):c.replace("{{style}}","");var b="textarea"==g?a.startButtonClass+" wpglobus-textarea wpglobus-textarea-"+a.clone_id:a.startButtonClass;c=c.replace("{{classes}}",b),c=""==o.dialogTitle?c.replace("{{title}}",a.dialogTitle):c.replace("{{title}}",o.dialogTitle),c=""==o.sbTitle?c.replace("{{sbTitle}}",o.sbTitle):c.replace("{{sbTitle}}",'title="'+o.sbTitle+'"'),t(c).insertAfter(s),t(n).insertAfter(s),"textarea"==g&&(t("#wpglobus-"+a.clone_id).addClass("wpglobus-textarea-"+a.clone_id),t(".wpglobus-textarea-"+a.clone_id).wrapAll('<div class="wpglobus-textarea-wrapper" style="'+o.styleTextareaWrapper+'"></div>'));var p,m=!1;if(""==o.onChangeClass)p="#wpglobus-"+a.clone_id;else{p="."+o.onChangeClass;var v=t._data(t(document)[0],"events");void 0===v?m=!0:void 0!==v.change&&t.each(v.change,function(t,a){if(a.selector==p)return m=!0,!1})}m||t(document).on("change",p,function(){var a=t(this),e=a.data("source-id");e=""==e?a.data("nodename")+'[name="'+a.data("source-name")+'"]':"#"+e,t(e).val(WPGlobusCore.getString(t(e).val(),a.val()))})}},saveDialog:function(){var e,o,n,i="",l="",s="";t(".wpglobus_dialog_textarea").each(function(a,d){e=t(d),o=e.val(),(n=e.data("language"))==WPGlobusAdmin.data.language&&(s=o),""!=o&&(i+=WPGlobusCore.addLocaleMarks(o,n),n==WPGlobusCoreData.default_language&&(l=o))}),i=i.length==l.length+8?l:i,t(a.id).val(i),i=""==s?l:s,t(a.wpglobus_id).val(i)},dialog:t("#wpglobus-dialog-wrapper").dialog({autoOpen:!1,width:650,modal:!0,dialogClass:"wpglobus-dialog",buttons:[{text:"Save",class:"wpglobus-button-save",click:function(){a.saveDialog(),a.dialog.dialog("close")}},{text:"Cancel",class:"wpglobus-button-cancel",click:function(){a.dialog.dialog("close")}}],open:function(){var e=a.dialogTitle;void 0!==a.attrs.maxlength&&(t(".wpglobus_dialog_textarea").attr("maxlength",a.attrs.maxlength),e+=" | maxlength="+a.attrs.maxlength),t(".wpglobus-dialog .ui-dialog-title").text(e)},close:function(){a.form[0].reset()}}),attachListener:function(){t(document).on("click",a.option.settingsClass,function(){t(".wpglobus_dialog_options_wrapper").hasClass("hidden")?t(".wpglobus_dialog_options_wrapper").removeClass("hidden"):t(".wpglobus_dialog_options_wrapper").addClass("hidden")}),t(document).on("click",".wpglobus_dialog_option",function(e){var o=t(this),n=o.data("object");a.order.action="save_post_meta_settings",a.order.post_type=WPGlobusAdmin.data.post_type,a.order.checked=o.prop("checked"),a.order.id=o.attr("id"),a.order.meta_key=o.data("meta-key"),a.ajax(a.order).done(function(a){"ok"==a.result&&("true"==a.checked?t(n).removeClass("wpglobus_dialog_start_hidden"):t(n).addClass("wpglobus_dialog_start_hidden"))}).fail(function(t){}).always(function(t,a){})}),t(document).on("click",a.option.listenClass,function(e){a.element=t(this),a.id=a.element.data("source-id"),""==a.id?(a.id=a.element.data("nodename")+'[name="'+a.element.data("source-name")+'"]',a.wpglobus_id="#wpglobus-"+a.convertToId(a.element.data("source-name"))):(a.wpglobus_id="#wpglobus-"+a.id,a.id="#"+a.id),a.clicks++,1==a.clicks&&setTimeout(function(){if(1==a.clicks)a.onClick(e);else{var o=t(a.id);o.hasClass("hidden")?o.removeClass("hidden").attr("style","display:block;"):o.addClass("hidden").attr("style","display:none;")}a.clicks=0},200)}),a.form=a.dialog.find("form#wpglobus-dialog-form").on("submit",function(t){t.preventDefault(),a.saveDialog()})},ajax:function(a){return t.ajax({type:"POST",url:WPGlobusAdmin.ajaxurl,data:{action:WPGlobusAdmin.process_ajax,order:a},dataType:"json",async:!1})},onClick:function(e){void 0===a.element.data("dialog-title")||""==a.element.data("dialog-title")?a.dialogTitle=a.option.dialogTitle:a.dialogTitle=a.element.data("dialog-title"),void 0!==a.id&&(a.attrs.maxlength=t(a.id).attr("maxlength")),a.source=a.element.data("source-value"),void 0===a.source&&(a.source=t(a.id).val(),"ajax"==a.request||(a.value=WPGlobusCore.getTranslations(a.source))),t.each(a.value,function(a,e){t("#wpglobus-dialog-"+a).val(e)}),a.dialog.dialog("open")}}}(jQuery),jQuery(document).ready(function(){"use strict";window.WPGlobusAdminApp=(t=window.WPGlobusAdminApp||{},a=jQuery,t.App=function(t){void 0===window.WPGlobusAdminApp&&(this.config={debug:!1,version:WPGlobusAdmin.version},this.status="ok","undefined"===WPGlobusAdmin?(this.status="error",this.config.debug&&console.log("Error options loading")):this.config.debug&&console.dir(WPGlobusAdmin),this.config.disable_first_language=['<div id="disable_first_language" style="display:block;" class="redux-field-errors notice-red">',"<strong>","<span>&nbsp;</span>",WPGlobusAdmin.i18n.cannot_disable_language,"</strong>","</div>"].join(""),a.extend(this.config,t),"ok"===this.status&&this.init())},t.App.prototype={$document:a(document),init:function(){WPGlobusCoreData.multisite=this.parseBool(WPGlobusCoreData.multisite),this.admin_init(),a("#content").addClass("wpglobus-editor").attr("data-language",WPGlobusAdmin.data.default_language),a("textarea[id^=content_]").each(function(t,e){var o=a(e).attr("id").replace("content_","");a(e).attr("data-language",o)}),"post.php"===WPGlobusAdmin.page?(this.post_edit(),this.set_dialog(),"undefined"!=typeof WPGlobusAioseop&&WPGlobusAioseop.init()):"menu-edit"===WPGlobusAdmin.page?this.nav_menus():"taxonomy-edit"===WPGlobusAdmin.page?WPGlobusAdmin.data.tag_id&&this.taxonomy_edit():"taxonomy-quick-edit"===WPGlobusAdmin.page?this.quickEdit("taxonomy"):"edit.php"===WPGlobusAdmin.page?this.quickEdit("post"):"options-general.php"==WPGlobusAdmin.page?this.options_general():"widgets.php"==WPGlobusAdmin.page?(WPGlobusWidgets.init(),WPGlobusDialogApp.init({dialogTitle:"Edit text"})):"wpglobus_options"==WPGlobusAdmin.page?this.start():"wpglobusAdminCentral"==WPGlobusAdmin.page?this.adminCentral():WPGlobusDialogApp.init({customData:WPGlobusCoreData.page_custom_data})},parseBool:function(t){return!/^(false|0)$/i.test(t)&&!!t},getCurrentTab:function(){return a(".wpglobus-post-body-tabs-list .ui-tabs-active").data("language")},admin_init:function(){var t=a(".wpglobus-addons-group a").data("key");if(void 0!==t)if(window.location.search.indexOf("page=wpglobus_options&tab="+t)>=0)WPGlobusCoreData.multisite?window.location=WPGlobusCoreData.pluginInstallLocation.multisite:window.location=WPGlobusCoreData.pluginInstallLocation.single;else{var e=a("#toplevel_page_wpglobus_options li").eq(t+1);WPGlobusCoreData.multisite?a(e).find("a").attr("href",WPGlobusCoreData.pluginInstallLocation.multisite).attr("onclick","window.location=jQuery(this).attr('href');return false;"):a(e).find("a").attr("href",WPGlobusCoreData.pluginInstallLocation.single).attr("onclick","window.location=jQuery(this).attr('href');return false;")}},options_general:function(){var t=a("#blogname"),e=a("body");t.addClass("hidden"),a("#wpglobus-blogname").insertAfter(t).removeClass("hidden"),e.on("blur",".wpglobus-blogname",function(){a(".wpglobus-blogname").each(function(e,o){var n=a(o);t.val(WPGlobusCore.getString(t.val(),n.val(),n.data("language")))})});var o=a("#blogdescription");o.addClass("hidden"),a("#wpglobus-blogdescription").insertAfter(o).removeClass("hidden"),e.on("blur",".wpglobus-blogdesc",function(){a(".wpglobus-blogdesc").each(function(t,e){var n=a(e);o.val(WPGlobusCore.getString(o.val(),n.val(),n.data("language")))})})},quickEdit:function(t){if(void 0!==WPGlobusAdmin.data.has_items&&WPGlobusAdmin.data.has_items){var e="",o=0;a(document).ajaxComplete(function(t,n,i){void 0!==i.data&&""!=e&&i.data.indexOf("action=inline-save-tax&")>=0&&(a("#"+e+" a.row-title").text(WPGlobusAdmin.qedit_titles[o][WPGlobusAdmin.data.language].name),a("#"+e+" .description").text(WPGlobusAdmin.qedit_titles[o][WPGlobusAdmin.data.language].description))});var n={};a("#the-list tr").each(function(e,i){var l=a(i),s="post"===t?"post-":"tag-";o=l.attr("id").replace(s,""),n[o]={},"post"===t?n[o].source=l.find(".post_title").text():"taxonomy"===t&&(n[o].source=a("#inline_"+o+" .name").text())});var i={};i.action="get_titles",i.type=t,i.taxonomy=void 0!==WPGlobusAdmin.data.taxonomy&&WPGlobusAdmin.data.taxonomy,i.title=n,a.ajax({type:"POST",url:WPGlobusAdmin.ajaxurl,data:{action:WPGlobusAdmin.process_ajax,order:i},dataType:"json"}).done(function(t){WPGlobusAdmin.qedit_titles=t.qedit_titles,a.each(t.bulkedit_post_titles,function(t,e){a("#inline_"+t+" .post_title").text(e[WPGlobusAdmin.data.language].name)})}).fail(function(t){}).always(function(t,a){}),a("body").on("change",".wpglobus-quick-edit-title",function(){var t="",e=[];a(".wpglobus-quick-edit-title").each(function(n,i){var l=a(i),s=l.data("language");""!==l.val()&&(t=WPGlobusCore.getString(t,l.val(),s)),WPGlobusAdmin.qedit_titles[o][s].name=l.val(),e[n]=s});var n=a(document).triggerHandler("wpglobus_get_translations",{string:t,lang:e,id:o});void 0!==n&&(t=n),a("input.ptitle").eq(0).attr("value",t),WPGlobusAdmin.qedit_titles[o].source=t}),void 0!==WPGlobusAdmin.data.tags&&a.each(WPGlobusAdmin.data.tags,function(t,a){WPGlobusAdmin.data.value[a].post_id={}}),a("button.save, input#bulk_edit").on("mouseenter",function(t){void 0!==WPGlobusAdmin.data.tags&&("bulk_edit"==t.currentTarget.id?a("input#bulk_edit").unbind("click"):a("button.save").unbind("click"),a("button.save, input#bulk_edit").on("click",function(t){console.log("Start Updating");var e=a.when(),n=(a(this),a.Deferred());n.resolve(function(e){e.next(".spinner").css({visibility:"visible"}),"bulk_edit"!=t.currentTarget.id&&a.ajaxSetup({async:!1});var o,n,i,l=e.parents("tr"),s=l.attr("id").replace("edit-","");a.each(WPGlobusAdmin.data.tags,function(t,a){if(0==(o=l.find("textarea[name='"+WPGlobusAdmin.data.names[a]+"']")).length)return!0;WPGlobusAdmin.data.value[a].post_id[s]=o.val(),n=WPGlobusAdmin.data.value[a].post_id[s].split(","),i=[];for(var e=0;e<n.length;e++)n[e]=n[e].trim(" "),""!=n[e]&&(void 0===WPGlobusAdmin.data.tag[a][n[e]]?i[e]=n[e]:i[e]=WPGlobusAdmin.data.tag[a][n[e]]);o.val(i.join(", "))})}(a(this))),e=e.then(function(){return a.when(n.done())}).then(function(){"bulk_edit"!=t.currentTarget.id&&setTimeout(function(){inlineEditPost.save(o),a.ajaxSetup({async:!0})},50)})}))}),a("#the-list").on("click","a.editinline",function(){var n=a(this);if(e=n.parents("tr").attr("id"),"post"===t)o=e.replace("post-","");else{if("taxonomy"!==t)return;o=e.replace("tag-","")}"post"===t&&void 0!==WPGlobusAdmin.data.tags&&a.each(WPGlobusAdmin.data.tags,function(t,e){if(""!=WPGlobusAdmin.data.value[e]){var n,i=a("#edit-"+o+' textarea[name="'+WPGlobusAdmin.data.names[e]+'"]').val();void 0!==i&&(n=i.split(","),a.each(n,function(t,a){i=i.replace(a,WPGlobusCore.TextFilter(a,WPGlobusCoreData.language))}),a("#edit-"+o+' textarea[name="'+WPGlobusAdmin.data.names[e]+'"]').val(i))}});var i=a("#edit-"+o+" input.ptitle").eq(0),l=i.parents("label");i.val(WPGlobusAdmin.qedit_titles[o].source),i.addClass("hidden"),a(WPGlobusAdmin.data.template).insertAfter(l),void 0===WPGlobusAdmin.qedit_titles[o]&&(WPGlobusAdmin.qedit_titles[o]={},WPGlobusAdmin.qedit_titles[o].source=a("#"+e+" .name a.row-title").text(),a(WPGlobusAdmin.data.enabled_languages).each(function(t,a){WPGlobusAdmin.qedit_titles[o][a]={},a==WPGlobusAdmin.data.default_language?WPGlobusAdmin.qedit_titles[o][a].name=WPGlobusAdmin.qedit_titles[o].source:WPGlobusAdmin.qedit_titles[o][a].name="",WPGlobusAdmin.qedit_titles[o][a].description=""})),a(".wpglobus-quick-edit-title").each(function(t,e){var n=a(e),i=n.data("language");n.attr("id",i+o),void 0!==WPGlobusAdmin.qedit_titles[o][i]&&(WPGlobusAdmin.qedit_titles[o][i].name=WPGlobusAdmin.qedit_titles[o][i].name.replace(/\\\'/g,"'"),WPGlobusAdmin.qedit_titles[o][i].name=WPGlobusAdmin.qedit_titles[o][i].name.replace(/\\\"/g,'"'),n.attr("value",WPGlobusAdmin.qedit_titles[o][i].name),WPGlobusAdmin.qedit_titles[o].source=WPGlobusCore.getString(WPGlobusAdmin.qedit_titles[o].source,WPGlobusAdmin.qedit_titles[o][i].name,i))}),a("input.ptitle").eq(0).attr("value",WPGlobusAdmin.qedit_titles[o].source)})}},taxonomy_edit:function(){var t=[];t[0]="name",t[1]="description",a.each(WPGlobusCoreData.enabled_languages,function(e,o){a.each(t,function(t,e){!function(t,e){var o,n=a("#"+t),i=n.clone(),l=n.attr("name"),s="wpglobus-element wpglobus-element_"+t+" wpglobus-element_"+e+" wpglobus-translatable";o=(o=document.getElementById(t)).nodeName,a(i).attr("id",t+"_"+e),a(i).attr("name",l+"_"+e),e!==WPGlobusCoreData.default_language&&(s+=" hidden"),a(i).attr("class",s),a(i).attr("data-save-to",t),a(i).attr("data-language",e),"INPUT"==o?a(i).attr("value",a("#wpglobus-link-tab-"+e).data(t)):"TEXTAREA"==o&&a(i).text(a("#wpglobus-link-tab-"+e).data(t)),n.addClass("hidden"),0==a(".wpglobus-element_"+t).size()?a(i).insertAfter(n):a(i).insertAfter(a(".wpglobus-element_"+t).last())}(e,o)})}),a(".wpglobus-taxonomy-tabs").insertAfter("#ajax-response"),a(".wrap").tabs(),a("body").on("click",".wpglobus-taxonomy-tabs li",function(t){var e=a(this).data("language");a(".wpglobus-element").addClass("hidden"),a(".wpglobus-element_"+e).removeClass("hidden")}),a(".wpglobus-element").on("change",function(){var t=a(this).data("save-to"),e="";a(".wpglobus-element").each(function(o,n){var i=a(n),l=i.val();i.data("save-to")==t&&""!==l&&(e+=WPGlobusCore.addLocaleMarks(l,i.data("language")))}),a("#"+t).val(e)})},nav_menus:function(){var t,e,o="#menu-to-edit .menu-item",n=function(){e!==a(o).size()&&(clearInterval(t),a(o).each(function(t,e){var o=a(e);if(!o.hasClass("wpglobus-menu-item")){var n=a(e).attr("id");a.each(["input.edit-menu-item-title","input.edit-menu-item-attr-title"],function(t,e){var o=a("#"+n+" "+e),i=a(o);if(!i.hasClass("wpglobus-hidden")){i.addClass("wpglobus-hidden"),i.css("display","none");var l=i.parent("label"),s=i.parents("p");a(s).css("height","80px"),a(l).append('<div style="color:#f00;">'+WPGlobusAdmin.i18n.save_nav_menu+"</div>")}}),o.addClass("wpglobus-menu-item")}}))};a.ajaxSetup({beforeSend:function(i,l){void 0!==l.data&&l.data.indexOf("action=add-menu-item")>=0&&(e=a(o).size(),t=setInterval(n,500))}}),a(o).each(function(t,e){var o=a(e).attr("id"),n=o.replace("menu-item-","");a.each(["input.edit-menu-item-title","input.edit-menu-item-attr-title"],function(t,e){var i=a("#"+o+" "+e);i.val()!=WPGlobusAdmin.data.items[n][e].source&&i.val(WPGlobusAdmin.data.items[n][e].source);var l=a("#"+o+" "+e).parents("p"),s=0;a.each(WPGlobusAdmin.data.open_languages,function(o,d){var u=i.clone();u.attr("id",i.attr("id")+"-"+d),u.attr("name",i.attr("id")+"-"+d),u.attr("data-language",d),u.attr("data-item-id",n),u.attr("placeholder",WPGlobusAdmin.data.en_language_name[d]);var r=WPGlobusAdmin.data.items[n][d][e].class;0===t&&d===WPGlobusAdmin.data.default_language?u.attr("class",r+" edit-menu-item-title"):u.attr("class",r),""!=WPGlobusAdmin.data.items[n][d][e].caption?u.attr("value",WPGlobusAdmin.data.items[n][d][e].caption):u.attr("value",""),u.css("margin-bottom","0.6em"),a(l).append(u),s=o}),s=40*(s+1),i.css("display","none").attr("class","").addClass("widefat wpglobus-hidden"),a(l).css("height",s+"px").addClass("wpglobus-menu-item-box")}),a(e).addClass("wpglobus-menu-item")}),a(".menus-move-left, .menus-move-right").each(function(t,e){var o,n=a(e),i=(n.parents("li").attr("id").replace("menu-item-",""),n.attr("title"));void 0!==i&&a.each(WPGlobusAdmin.data.post_titles,function(t,a){i.indexOf(t)>=0&&(o=i.replace(t,a),n.attr("title",o),n.text(o))})}),a(".edit-menu-item-title").trigger("change"),wpNavMenu.refreshAdvancedAccessibility(),wpNavMenu.menusChanged=!1,a(".wpglobus-menu-item").on("change",function(){var t,e,o=a(this),n=o.data("item-id");o.hasClass("wpglobus-item-title")&&(t=WPGlobusCore.getString(a("input#edit-menu-item-title-"+n).val(),o.val(),o.data("language")),void 0!==(e=a(document).triggerHandler("wpglobus_get_menu_translations",{string:t,lang:WPGlobusCoreData.open_languages,id:n,type:"input.edit-menu-item-title"}))&&(t=e),a("input#edit-menu-item-title-"+n).val(t)),o.hasClass("wpglobus-item-attr")&&(t=WPGlobusCore.getString(a("input#edit-menu-item-attr-title-"+n).val(),o.val(),o.data("language")),void 0!==(e=a(document).triggerHandler("wpglobus_get_menu_translations",{string:t,lang:WPGlobusCoreData.open_languages,id:n,type:"input.edit-menu-item-attr-title"}))&&(t=e),a("input#edit-menu-item-attr-title-"+n).val(t))})},post_edit:function(){a(document).on("heartbeat-send",function(t,e){void 0!==e.wp_autosave&&(e.wpglobus_heartbeat="wpglobus",a.each(WPGlobusAdmin.data.open_languages,function(t,o){var n=a("#title_"+o).val()||"";""!=(n=a.trim(n))&&(e.wp_autosave["post_title_"+o]=n),n=a("#content_"+o).val()||"",""!=(n=a.trim(n))&&(e.wp_autosave["content_"+o]=n)}))});var t="#postdivrich",e=!0,o="#post-body-content";if(!1===WPGlobusAdmin.data.support.editor&&(t="#titlediv",e=!1),!1===WPGlobusAdmin.data.support.title&&(e=!1),a(o).prepend(a(".wpglobus-post-body-tabs-list")),a.each(WPGlobusAdmin.tabs,function(o,n){"default"===n?(a(t).wrap('<div id="tab-default"></div>'),e&&a(a("#titlediv")).insertBefore(t)):(a(t+"-"+n).wrap('<div id="tab-'+n+'"></div>'),e&&a(a("#titlediv-"+n)).insertBefore(t+"-"+n))}),a(o).addClass("wpglobus-post-body-tabs").tabs({beforeActivate:function(t,e){var o=e.oldTab[0].id.replace("link-tab-",""),n=e.newTab[0].id.replace("link-tab-","");"default"==o&&(o=WPGlobusCoreData.default_language),"default"==n&&(n=WPGlobusCoreData.default_language);var i=a(document).triggerHandler("wpglobus_post_body_tabs",[o,n]);return!(!i&&void 0!==i)}}),a("#title").val(WPGlobusAdmin.title),a("#content").text(WPGlobusAdmin.content),"undefined"!=typeof WPGlobusVendor&&WPGlobusVendor.vendor.WPSEO&&("undefined"!=typeof wpglobus_wpseo?wpglobus_wpseo():"undefined"!=typeof WPGlobusYoastSeo&&WPGlobusYoastSeo.init()),WPGlobusAdmin.data.modify_excerpt){var n=a("#excerpt");n.addClass("hidden").css({display:"none"}),a(WPGlobusAdmin.data.template).insertAfter(n),a("body").on("change",".wpglobus-excerpt",function(){var t=a(this);n.val(WPGlobusCore.getString(n.val(),t.val(),t.data("language")))})}if(void 0!==wp.utils&&void 0!==wp.utils.WordCounter){WPGlobusCoreData.wordCounter={};var i=this;a.each(WPGlobusCoreData.enabled_languages,function(t,a){if(a==WPGlobusCoreData.default_language)return!0;e=jQuery,o=new wp.utils.WordCounter,n=a,WPGlobusCoreData.wordCounter[n]={},WPGlobusCoreData.wordCounter[n].counter=o,e(function(){WPGlobusCoreData.wordCounter[n].content=e("#content_"+n),WPGlobusCoreData.wordCounter[n].count=e("#wp-word-count-"+n).find(".word-count-"+n),WPGlobusCoreData.wordCounter[n].prevCount=0;function t(t){var a,e;"object"==typeof t&&(t="tinymce"==t?i.getCurrentTab():t.target.id.replace("content_","")),void 0!==WPGlobusCoreData.wordCounter[t]&&(a=!WPGlobusCoreData.wordCounter[t].contentEditor||WPGlobusCoreData.wordCounter[t].contentEditor.isHidden()?WPGlobusCoreData.wordCounter[t].content.val():WPGlobusCoreData.wordCounter[t].contentEditor.getContent({format:"raw"}),(e=WPGlobusCoreData.wordCounter[t].counter.count(a))!==WPGlobusCoreData.wordCounter[t].prevCount&&WPGlobusCoreData.wordCounter[t].count.text(e),WPGlobusCoreData.wordCounter[t].prevCount=e)}e(document).on("tinymce-editor-init",function(a,e){if(-1!=e.id.indexOf("content_")){var o=e.id.replace("content_","");WPGlobusCoreData.wordCounter[o].contentEditor=e,e.on("nodechange keyup",_.debounce(t,1e3))}}),WPGlobusCoreData.wordCounter[n].content.on("input keyup",_.debounce(t,1e3)),t(n)});var e,o,n})}if("undefined"!=typeof wpWordCount){var l=0,s=WPGlobusCoreData.open_languages,d=this.$document,u={};s.shift(),a.each(WPGlobusCoreData.open_languages,function(t,a){u[a]=0});var r={settings:{strip:/<[a-zA-Z\/][^<>]*>/g,clean:/[0-9.(),;:!?%#$¿'"_+=\\/-]+/g,w:/\S\s+/g,c:/\S/g},block:u,wc:function(t,e,o){var n,i=this,l=0;n=e==WPGlobusCoreData.default_language?a(".word-count"):a(".word-count-"+e),void 0===o&&(o=wordCountL10n.type),"w"!==o&&"c"!==o&&(o="w"),i.block[e]||(i.block[e]=1,setTimeout(function(){t&&(t=(t=t.replace(i.settings.strip," ").replace(/&nbsp;|&#160;/gi," ")).replace(i.settings.clean,"")).replace(i.settings[o],function(){l++}),n.html(l.toString()),setTimeout(function(){i.block[e]=0},2e3)},1))}};d.bind("wpglobuscountwords",function(t,a,e){r.wc(a,e)}),a.each(s,function(t,e){var o=a("#content_"+e);d.triggerHandler("wpglobuscountwords",[o.val(),e]),o.keyup(function(t){var a=t.keyCode||t.charCode;return a==l||(13!=a&&8!=l&&46!=l||d.triggerHandler("wpglobuscountwords",[o.val(),e]),l=a,!0)})}),a(document).triggerHandler("wpglobuscountwords",[a("#content").val(),WPGlobusCoreData.default_language])}a("body").on("click","#publish, #save-post",function(){if(WPGlobusAdmin.data.open_languages.length>1){a(document).triggerHandler("wpglobus_before_save_post",{content_tabs_id:o});var t,e=a("#title").val(),n="",i="";0==e.length&&(t=WPGlobusAdmin.data.open_languages.indexOf(WPGlobusAdmin.data.default_language),WPGlobusAdmin.data.open_languages.splice(t,1),a(WPGlobusAdmin.data.open_languages).each(function(t,o){i=0==t?"":"-",(e=a("#title_"+o).val()).length>0&&(0==n.length&&(i=""),n=n+i+e)})),n.length>0&&a("#title").val(n)}void 0===WPGlobusAdmin.data.tagsdiv||WPGlobusAdmin.data.tagsdiv.length<1||a(WPGlobusAdmin.data.tagsdiv).each(function(t,e){if(0==a("#"+e).size())return!0;var o=e.replace("tagsdiv-","");if("undefined"===o)return!0;if(0==a("#tax-input-"+o).size())return!0;var n,i=[];a("#tagsdiv-"+o+" .tagchecklist span").each(function(t,e){n=(n=a(e).text()).replace("X","").trim(" "),void 0===WPGlobusAdmin.data.tag[o][n]?i[t]=n:i[t]=WPGlobusAdmin.data.tag[o][n]}),a("#tax-input-"+o).val(i.join(", "))})}),a(".ui-state-default").on("click",function(){"link-tab-default"===a(this).attr("id")&&(a(window).scrollTop(a(window).scrollTop()+1),a(window).scrollTop(a(window).scrollTop()-1))})},adminCentral:function(){a(".wpglobus-admin-central-tab").css({display:"none"}),a(".nav-tab-active").length>1&&a(".wpglobus-about-wrap .nav-tab-wrapper a").removeClass("nav-tab-active");var t=!0;0==location.hash.indexOf("#")&&a(".wpglobus-about-wrap .nav-tab-wrapper a").each(function(e,o){a(o).attr("href")==location.hash&&(t=!1,a(o).addClass("nav-tab-active"))}),t&&a(".wpglobus-about-wrap .nav-tab-wrapper a").eq(0).addClass("nav-tab-active");var e=a(".wpglobus-about-wrap .nav-tab-active").data("tab-id");""!=e&&a("#"+e).css({display:"block"}),a(document).on("click",".wpglobus-about-wrap .nav-tab",function(t){var e=a(this);e.hasClass("nav-tab-active")||(a(".wpglobus-admin-central-tab").css({display:"none"}),a(".wpglobus-about-wrap .nav-tab").removeClass("nav-tab-active"),e.addClass("nav-tab-active"),""!=e.data("tab-id")&&a("#"+e.data("tab-id")).css({display:"block"}))})},start:function(){var t=this;a("#wpglobus_flags").select2({formatResult:this.format,formatSelection:this.format,minimumResultsForSearch:-1,escapeMarkup:function(t){return t}}),a("body").on("click","#enabled_languages-list li:first input",function(e){return e.preventDefault(),a(".redux-save-warn").css({display:"none"}),a("#enabled_languages-list").find("li:first > input").val("1"),0===a("#disable_first_language").length&&a(t.config.disable_first_language).insertAfter("#info_bar"),!1})},format:function(t){return'<img class="wpglobus_flag" src="'+WPGlobusAdmin.flag_url+t.text+'"/>&nbsp;&nbsp;'+t.text},set_dialog:function(){if(void 0===WPGlobusAdmin.data.customFieldsEnabled||(WPGlobusAdmin.data.customFieldsEnabled=this.parseBool(WPGlobusAdmin.data.customFieldsEnabled),WPGlobusAdmin.data.customFieldsEnabled)){var t,e=!1,o=function(t){var o,n,i,l="wpglobus_dialog_start wpglobus_dialog_icon";i=['<div class="wpglobus_dialog_options_wrapper hidden">','<input style="width:initial;" id="wpglobus-cb-{{id}}" data-object="#wpglobus-dialog-start-{{id}}" data-meta-key="{{meta-key}}" class="wpglobus_dialog_option wpglobus_dialog_cb" type="checkbox" {{checked}} />',"</div>"].join(""),a(void 0===t?"#the-list tr":"#the-list tr#"+t).each(function(){var t,e,s,d=a(this),u=d.attr("id"),r=d.find("textarea"),c=l;if(void 0===(o=r.attr("id")))return!0;s=a("#"+u+"-key").val(),t=a("#"+o).clone(),a(r).addClass("wpglobus-dialog-field-source hidden"),e=r.attr("name"),a(t).attr("id","wpglobus-"+o),a(t).attr("name","wpglobus-"+e),a(t).attr("data-source-id",o),a(t).attr("class","wpglobus-dialog-field"),a(t).val(WPGlobusCore.TextFilter(a(r).val(),WPGlobusCoreData.language)),a(t).insertAfter(r),n=(n=i.replace(/{{id}}/g,o)).replace(/{{meta-key}}/g,s),void 0===WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type]?n=n.replace(/{{checked}}/,"checked"):void 0!==WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][s]&&"false"==WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][s]?(n=n.replace(/{{checked}}/,""),c=l+" wpglobus_dialog_start_hidden"):(n=n.replace(/{{checked}}/,"checked"),c=l),d.append('<td style="width:20px;"><div id="wpglobus-dialog-start-'+o+'" data-type="control" data-source-type="textarea" data-source-id="'+o+'" class="'+c+'"></div>'+n+"</td>")}),!e&&a("#list-table .wpglobus_dialog_start").length>0&&(a("#list-table thead tr").append('<th class="wpglobus-control-head"><div class="wpglobus_dialog_settings wpglobus_dialog_icon"></div></th>'),e=!0)};o(),a("body").on("change",".wpglobus-dialog-field",function(){var t,e=a(this),o="#"+e.data("source-id"),n="",i="";void 0!==o&&(n=a(o).val(),/(\{:|\[:|<!--:)[a-z]{2}/.test(n)?(a.each(WPGlobusCoreData.enabled_languages,function(a,o){""!=(t=o==WPGlobusCoreData.language?e.val():WPGlobusCore.TextFilter(n,o,"RETURN_EMPTY"))&&(i+=WPGlobusCore.addLocaleMarks(t,o))}),a(o).val(i)):a(o).val(e.val()))}),a(document).ajaxSend(function(a,e,o){"add-meta"==o.action&&(t=o.element)}),a(document).ajaxComplete(function(e,n,i){"add-meta"==i.action&&void 0!==n.responseXML&&o("newmeta"==t?"meta-"+a(n.responseXML.documentElement.outerHTML).find("meta").attr("id"):t)}),WPGlobusDialogApp.init({dialogTitle:"Edit meta"})}}},new t.App,t);var t,a});
1
+ var WPGlobusCore,WPGlobusDialogApp;!function(i){var d;d=WPGlobusCore={strpos:function(t,a,e){var o=(t=""+t).indexOf(a,e);return 0<=o&&o},TextFilter:function(t,a,e){if(void 0===t||""===t)return t;var o,n,i=[],l=!1;a=""==a?"en":a,e=void 0===e||""==e?"RETURN_IN_DEFAULT_LANGUAGE":e,i[0]=[],i[0].start=WPGlobusCoreData.locale_tag_start.replace("%s",a),i[0].end=WPGlobusCoreData.locale_tag_end,i[1]=[],i[1].start="\x3c!--:"+a+"--\x3e",i[1].end="\x3c!--:--\x3e",i[2]=[],i[2].start="[:"+a+"]",i[2].end="[:";for(var s=0;s<3;s++)if(!1!==(o=d.strpos(t,i[s].start))){o+=i[s].start.length,t=!1===(n=d.strpos(t,i[s].end,o))?t.substr(o):t.substr(o,n-o),l=!0;break}return l||("RETURN_EMPTY"==e?(a!=WPGlobusCoreData.default_language||/(\{:|\[:|<!--:)[a-z]{2}/.test(t))&&(t=""):a==WPGlobusCoreData.default_language?/(\{:|\[:|<!--:)[a-z]{2}/.test(t)&&(t=""):t=d.TextFilter(t,WPGlobusCoreData.default_language)),t},addLocaleMarks:function(t,a){return WPGlobusCoreData.locale_tag_start.replace("%s",a)+t+WPGlobusCoreData.locale_tag_end},getTranslations:function(e){var o,n={};return i.each(WPGlobusCoreData.enabled_languages,function(t,a){o=a==WPGlobusCoreData.default_language?"RETURN_IN_DEFAULT_LANGUAGE":"RETURN_EMPTY",n[a]=d.TextFilter(e,a,o)}),n},getString:function(t,a,e){if(void 0===t)return t;void 0===a&&(a=""),void 0===e&&(e=WPGlobusCoreData.language),(t=d.getTranslations(t))[e]=a;var o="";return i.each(t,function(t,a){""!=a&&t!=WPGlobusCoreData.default_language&&(o+=d.addLocaleMarks(a,t))}),""!=t[WPGlobusCoreData.default_language]&&(o=""==o?t[WPGlobusCoreData.default_language]:d.addLocaleMarks(t[WPGlobusCoreData.default_language],WPGlobusCoreData.default_language)+o),o}}}(jQuery),function(m){var v;v=WPGlobusDialogApp={option:{listenClass:".wpglobus_dialog_start",settingsClass:".wpglobus_dialog_settings",dialogTabs:"#wpglobus-dialog-tabs",dialogTitle:"",customData:null,callback:function(){}},form:void 0,element:void 0,element_by:"id",id:"",clone_id:"",wpglobus_id:"",type:"textarea",source:"",order:{},value:{},request:"core",attrs:{},dialogTitle:"",trClass:"wpglobus-translatable",startButton:['<span id="wpglobus-dialog-start-{{clone_id}}" ','style="{{style}}" ','data-type="control" data-dialog-title="{{title}}" ','data-source-type="" data-source-id="{{id}}" data-source-name="{{name}}" ','data-nodename="{{nodename}}"',"{{sbTitle}} ",'class="{{classes}}"></span>'].join(""),startButtonClass:"wpglobus_dialog_start wpglobus_dialog_icon",clicks:0,init:function(t){v.option=m.extend(v.option,t),m(v.option.dialogTabs).tabs(),v.dialogTitle=v.option.dialogTitle,this.attachListener(),null!=v.option.customData&&void 0!==v.option.customData.addElements&&m.each(v.option.customData.addElements,function(t,a){v.addElement(a)})},convertToId:function(t){return t=(t=t.replace(/\]/g,"")).replace(/\[/g,"-")},addElement:function(t){var a={id:null,dialogTitle:"",style:"",styleTextareaWrapper:"",sbTitle:"",onChangeClass:""};if("string"==typeof t)a.id=t;else{if("object"!=typeof t)return;a=m.extend(a,t)}var e,o,n,i=null,l=null,s=null,d=null,u=v.startButton,r="";if(v.element_by="id",null===(d=document.getElementById(a.id))?(v.element_by="name",d=document.getElementsByName(a.id)):r=(r=d.nodeName).toLowerCase(),0!=d.length&&(l=a.id,"id"==v.element_by?i=m("#"+l):(r=(r=d[0].nodeName).toLowerCase(),i=m(r+'[name="'+l+'"]')),s="undefined"===i.attr("name")?l:i.attr("name"),v.clone_id=v.convertToId(l),-1==s.indexOf("wpglobus")&&-1==v.clone_id.indexOf("wpglobus")&&!(0<m("#wpglobus-"+v.clone_id).length||0<m(r+'[name="wpglobus-'+s+'"]').length))){e=m(i.clone()),n=i.attr("style")||"",i.attr("style","display:none;"),e.attr("id","wpglobus-"+v.clone_id).attr("name","wpglobus-"+s),e.addClass(v.trClass),""!=a.onChangeClass&&e.addClass(a.onChangeClass),"id"==v.element_by?e.attr("data-source-id",l).attr("data-source-name","").attr("data-source-get-by",v.element_by):e.attr("data-source-id","").attr("data-source-name",s).attr("data-source-get-by",v.element_by),"textarea"==r?(o=WPGlobusCore.getTranslations(i.text())[WPGlobusCoreData.language],e.text(o),e.attr("data-nodename","textarea"),""==a.style?e.attr("style",n+";width:95%;float:left;"):e.attr("style",n+";"+a.style)):(o=WPGlobusCore.getTranslations(i.val())[WPGlobusCoreData.language],e.attr("value",o),e.attr("data-nodename","input"),""!=a.style&&e.attr("style",n+";"+a.style)),u=u.replace(/{{clone_id}}/g,v.clone_id),u="id"==v.element_by?(u=(u=u.replace(/{{id}}/g,v.clone_id)).replace(/{{name}}/g,"")).replace(/{{nodename}}/g,""):(u=(u=u.replace(/{{id}}/g,"")).replace(/{{name}}/g,s)).replace(/{{nodename}}/g,r),u="textarea"==r?u.replace("{{style}}","float:left;margin-top:0;"):u.replace("{{style}}","");var c="textarea"==r?v.startButtonClass+" wpglobus-textarea wpglobus-textarea-"+v.clone_id:v.startButtonClass;u=u.replace("{{classes}}",c),u=""==a.dialogTitle?u.replace("{{title}}",v.dialogTitle):u.replace("{{title}}",a.dialogTitle),u=""==a.sbTitle?u.replace("{{sbTitle}}",a.sbTitle):u.replace("{{sbTitle}}",'title="'+a.sbTitle+'"'),m(u).insertAfter(i),m(e).insertAfter(i),"textarea"==r&&(m("#wpglobus-"+v.clone_id).addClass("wpglobus-textarea-"+v.clone_id),m(".wpglobus-textarea-"+v.clone_id).wrapAll('<div class="wpglobus-textarea-wrapper" style="'+a.styleTextareaWrapper+'"></div>'));var g,b=!1;if(""==a.onChangeClass)g="#wpglobus-"+v.clone_id;else{g="."+a.onChangeClass;var p=m._data(m(document)[0],"events");void 0===p?b=!0:void 0!==p.change&&m.each(p.change,function(t,a){if(a.selector==g)return b=!0,!1})}b||m(document).on("change",g,function(){var t=m(this),a=t.data("source-id");a=""==a?t.data("nodename")+'[name="'+t.data("source-name")+'"]':"#"+a,m(a).val(WPGlobusCore.getString(m(a).val(),t.val()))})}},saveDialog:function(){var e,o,n,i="",l="",s="";m(".wpglobus_dialog_textarea").each(function(t,a){e=m(a),o=e.val(),(n=e.data("language"))==WPGlobusAdmin.data.language&&(s=o),""!=o&&(i+=WPGlobusCore.addLocaleMarks(o,n),n==WPGlobusCoreData.default_language&&(l=o))}),i=i.length==l.length+8?l:i,m(v.id).val(i),i=""==s?l:s,m(v.wpglobus_id).val(i)},dialog:m("#wpglobus-dialog-wrapper").dialog({autoOpen:!1,width:650,modal:!0,dialogClass:"wpglobus-dialog",buttons:[{text:"Save",class:"wpglobus-button-save",click:function(){v.saveDialog(),v.dialog.dialog("close")}},{text:"Cancel",class:"wpglobus-button-cancel",click:function(){v.dialog.dialog("close")}}],open:function(){var t=v.dialogTitle;void 0!==v.attrs.maxlength&&(m(".wpglobus_dialog_textarea").attr("maxlength",v.attrs.maxlength),t+=" | maxlength="+v.attrs.maxlength),m(".wpglobus-dialog .ui-dialog-title").text(t)},close:function(){v.form[0].reset()}}),attachListener:function(){m(document).on("click",v.option.settingsClass,function(){m(".wpglobus_dialog_options_wrapper").hasClass("hidden")?m(".wpglobus_dialog_options_wrapper").removeClass("hidden"):m(".wpglobus_dialog_options_wrapper").addClass("hidden")}),m(document).on("click",".wpglobus_dialog_option",function(t){var a=m(this),e=a.data("object");v.order.action="save_post_meta_settings",v.order.post_type=WPGlobusAdmin.data.post_type,v.order.checked=a.prop("checked"),v.order.id=a.attr("id"),v.order.meta_key=a.data("meta-key"),v.ajax(v.order).done(function(t){"ok"==t.result&&("true"==t.checked?m(e).removeClass("wpglobus_dialog_start_hidden"):m(e).addClass("wpglobus_dialog_start_hidden"))}).fail(function(t){}).always(function(t,a){})}),m(document).on("click",v.option.listenClass,function(a){v.element=m(this),v.id=v.element.data("source-id"),""==v.id?(v.id=v.element.data("nodename")+'[name="'+v.element.data("source-name")+'"]',v.wpglobus_id="#wpglobus-"+v.convertToId(v.element.data("source-name"))):(v.wpglobus_id="#wpglobus-"+v.id,v.id="#"+v.id),v.clicks++,1==v.clicks&&setTimeout(function(){if(1==v.clicks)v.onClick(a);else{var t=m(v.id);t.hasClass("hidden")?t.removeClass("hidden").attr("style","display:block;"):t.addClass("hidden").attr("style","display:none;")}v.clicks=0},200)}),v.form=v.dialog.find("form#wpglobus-dialog-form").on("submit",function(t){t.preventDefault(),v.saveDialog()})},ajax:function(t){return m.ajax({type:"POST",url:WPGlobusAdmin.ajaxurl,data:{action:WPGlobusAdmin.process_ajax,order:t},dataType:"json",async:!1})},onClick:function(t){void 0===v.element.data("dialog-title")||""==v.element.data("dialog-title")?v.dialogTitle=v.option.dialogTitle:v.dialogTitle=v.element.data("dialog-title"),void 0!==v.id&&(v.attrs.maxlength=m(v.id).attr("maxlength")),v.source=v.element.data("source-value"),void 0===v.source&&(v.source=m(v.id).val(),"ajax"==v.request||(v.value=WPGlobusCore.getTranslations(v.source))),m.each(v.value,function(t,a){m("#wpglobus-dialog-"+t).val(a)}),v.dialog.dialog("open")}}}(jQuery),jQuery(document).ready(function(){"use strict";var t,c;window.WPGlobusAdminApp=(t=window.WPGlobusAdminApp||{},c=jQuery,t.App=function(t){void 0===window.WPGlobusAdminApp&&(this.config={debug:!1,version:WPGlobusAdmin.version},this.status="ok","undefined"===WPGlobusAdmin?(this.status="error",this.config.debug&&console.log("Error options loading")):this.config.debug&&console.dir(WPGlobusAdmin),this.config.disable_first_language=['<div id="disable_first_language" style="display:block;" class="redux-field-errors notice-red">',"<strong>","<span>&nbsp;</span>",WPGlobusAdmin.i18n.cannot_disable_language,"</strong>","</div>"].join(""),c.extend(this.config,t),"ok"===this.status&&this.init())},t.App.prototype={$document:c(document),init:function(){WPGlobusCoreData.multisite=this.parseBool(WPGlobusCoreData.multisite),this.admin_init(),c("#content").addClass("wpglobus-editor").attr("data-language",WPGlobusAdmin.data.default_language),c("textarea[id^=content_]").each(function(t,a){var e=c(a).attr("id").replace("content_","");c(a).attr("data-language",e)}),"post.php"===WPGlobusAdmin.page?(this.post_edit(),this.set_dialog(),"undefined"!=typeof WPGlobusAioseop&&WPGlobusAioseop.init()):"menu-edit"===WPGlobusAdmin.page?this.nav_menus():"taxonomy-edit"===WPGlobusAdmin.page?WPGlobusAdmin.data.tag_id&&this.taxonomy_edit():"taxonomy-quick-edit"===WPGlobusAdmin.page?this.quickEdit("taxonomy"):"edit.php"===WPGlobusAdmin.page?this.quickEdit("post"):"options-general.php"==WPGlobusAdmin.page?this.options_general():"widgets.php"==WPGlobusAdmin.page?(WPGlobusWidgets.init(),WPGlobusDialogApp.init({dialogTitle:"Edit text"})):"wpglobus_options"==WPGlobusAdmin.page?this.start():"wpglobusAdminCentral"==WPGlobusAdmin.page?this.adminCentral():WPGlobusDialogApp.init({customData:WPGlobusCoreData.page_custom_data})},parseBool:function(t){return!/^(false|0)$/i.test(t)&&!!t},getCurrentTab:function(){return c(".wpglobus-post-body-tabs-list .ui-tabs-active").data("language")},admin_init:function(){var t=c(".wpglobus-addons-group a").data("key");if(void 0!==t)if(0<=window.location.search.indexOf("page=wpglobus_options&tab="+t))WPGlobusCoreData.multisite?window.location=WPGlobusCoreData.pluginInstallLocation.multisite:window.location=WPGlobusCoreData.pluginInstallLocation.single;else{var a=c("#toplevel_page_wpglobus_options li").eq(t+1);WPGlobusCoreData.multisite?c(a).find("a").attr("href",WPGlobusCoreData.pluginInstallLocation.multisite).attr("onclick","window.location=jQuery(this).attr('href');return false;"):c(a).find("a").attr("href",WPGlobusCoreData.pluginInstallLocation.single).attr("onclick","window.location=jQuery(this).attr('href');return false;")}},options_general:function(){var o=c("#blogname"),t=c("body");o.addClass("hidden"),c("#wpglobus-blogname").insertAfter(o).removeClass("hidden"),t.on("blur",".wpglobus-blogname",function(){c(".wpglobus-blogname").each(function(t,a){var e=c(a);o.val(WPGlobusCore.getString(o.val(),e.val(),e.data("language")))})});var n=c("#blogdescription");n.addClass("hidden"),c("#wpglobus-blogdescription").insertAfter(n).removeClass("hidden"),t.on("blur",".wpglobus-blogdesc",function(){c(".wpglobus-blogdesc").each(function(t,a){var e=c(a);n.val(WPGlobusCore.getString(n.val(),e.val(),e.data("language")))})})},quickEdit:function(n){if(void 0!==WPGlobusAdmin.data.has_items&&WPGlobusAdmin.data.has_items){var o="",l=0;c(document).ajaxComplete(function(t,a,e){void 0!==e.data&&""!=o&&0<=e.data.indexOf("action=inline-save-tax&")&&(c("#"+o+" a.row-title").text(WPGlobusAdmin.qedit_titles[l][WPGlobusAdmin.data.language].name),c("#"+o+" .description").text(WPGlobusAdmin.qedit_titles[l][WPGlobusAdmin.data.language].description))});var i={};c("#the-list tr").each(function(t,a){var e=c(a),o="post"===n?"post-":"tag-";l=e.attr("id").replace(o,""),i[l]={},"post"===n?i[l].source=e.find(".post_title").text():"taxonomy"===n&&(i[l].source=c("#inline_"+l+" .name").text())});var t={action:"get_titles"};t.type=n,t.taxonomy=void 0!==WPGlobusAdmin.data.taxonomy&&WPGlobusAdmin.data.taxonomy,t.title=i,c.ajax({type:"POST",url:WPGlobusAdmin.ajaxurl,data:{action:WPGlobusAdmin.process_ajax,order:t},dataType:"json"}).done(function(t){WPGlobusAdmin.qedit_titles=t.qedit_titles,c.each(t.bulkedit_post_titles,function(t,a){c("#inline_"+t+" .post_title").text(a[WPGlobusAdmin.data.language].name)})}).fail(function(t){}).always(function(t,a){}),c("body").on("change",".wpglobus-quick-edit-title",function(){var n="",i=[];c(".wpglobus-quick-edit-title").each(function(t,a){var e=c(a),o=e.data("language");""!==e.val()&&(n=WPGlobusCore.getString(n,e.val(),o)),WPGlobusAdmin.qedit_titles[l][o].name=e.val(),i[t]=o});var t=c(document).triggerHandler("wpglobus_get_translations",{string:n,lang:i,id:l});void 0!==t&&(n=t),c("input.ptitle").eq(0).attr("value",n),WPGlobusAdmin.qedit_titles[l].source=n}),void 0!==WPGlobusAdmin.data.tags&&c.each(WPGlobusAdmin.data.tags,function(t,a){WPGlobusAdmin.data.value[a].post_id={}}),c("button.save, input#bulk_edit").on("mouseenter",function(t){void 0!==WPGlobusAdmin.data.tags&&("bulk_edit"==t.currentTarget.id?c("input#bulk_edit").unbind("click"):c("button.save").unbind("click"),c("button.save, input#bulk_edit").on("click",function(a){console.log("Start Updating");var t=c.when(),e=(c(this),c.Deferred());e.resolve(function(t){t.next(".spinner").css({visibility:"visible"}),"bulk_edit"!=a.currentTarget.id&&c.ajaxSetup({async:!1});var o,n,i,l=t.parents("tr"),s=l.attr("id").replace("edit-","");c.each(WPGlobusAdmin.data.tags,function(t,a){if(0==(o=l.find("textarea[name='"+WPGlobusAdmin.data.names[a]+"']")).length)return!0;WPGlobusAdmin.data.value[a].post_id[s]=o.val(),n=WPGlobusAdmin.data.value[a].post_id[s].split(","),i=[];for(var e=0;e<n.length;e++)n[e]=n[e].trim(" "),""!=n[e]&&(void 0===WPGlobusAdmin.data.tag[a][n[e]]?i[e]=n[e]:i[e]=WPGlobusAdmin.data.tag[a][n[e]]);o.val(i.join(", "))})}(c(this))),t=t.then(function(){return c.when(e.done())}).then(function(){"bulk_edit"!=a.currentTarget.id&&setTimeout(function(){inlineEditPost.save(l),c.ajaxSetup({async:!0})},50)})}))}),c("#the-list").on("click","a.editinline",function(){var t=c(this);if(o=t.parents("tr").attr("id"),"post"===n)l=o.replace("post-","");else{if("taxonomy"!==n)return;l=o.replace("tag-","")}"post"===n&&void 0!==WPGlobusAdmin.data.tags&&c.each(WPGlobusAdmin.data.tags,function(t,a){if(""!=WPGlobusAdmin.data.value[a]){var e,o=c("#edit-"+l+' textarea[name="'+WPGlobusAdmin.data.names[a]+'"]').val();void 0!==o&&(e=o.split(","),c.each(e,function(t,a){o=o.replace(a,WPGlobusCore.TextFilter(a,WPGlobusCoreData.language))}),c("#edit-"+l+' textarea[name="'+WPGlobusAdmin.data.names[a]+'"]').val(o))}});var a=c("#edit-"+l+" input.ptitle").eq(0),e=a.parents("label");a.val(WPGlobusAdmin.qedit_titles[l].source),a.addClass("hidden"),c(WPGlobusAdmin.data.template).insertAfter(e),void 0===WPGlobusAdmin.qedit_titles[l]&&(WPGlobusAdmin.qedit_titles[l]={},WPGlobusAdmin.qedit_titles[l].source=c("#"+o+" .name a.row-title").text(),c(WPGlobusAdmin.data.enabled_languages).each(function(t,a){WPGlobusAdmin.qedit_titles[l][a]={},a==WPGlobusAdmin.data.default_language?WPGlobusAdmin.qedit_titles[l][a].name=WPGlobusAdmin.qedit_titles[l].source:WPGlobusAdmin.qedit_titles[l][a].name="",WPGlobusAdmin.qedit_titles[l][a].description=""})),c(".wpglobus-quick-edit-title").each(function(t,a){var e=c(a),o=e.data("language");e.attr("id",o+l),void 0!==WPGlobusAdmin.qedit_titles[l][o]&&(WPGlobusAdmin.qedit_titles[l][o].name=WPGlobusAdmin.qedit_titles[l][o].name.replace(/\\\'/g,"'"),WPGlobusAdmin.qedit_titles[l][o].name=WPGlobusAdmin.qedit_titles[l][o].name.replace(/\\\"/g,'"'),e.attr("value",WPGlobusAdmin.qedit_titles[l][o].name),WPGlobusAdmin.qedit_titles[l].source=WPGlobusCore.getString(WPGlobusAdmin.qedit_titles[l].source,WPGlobusAdmin.qedit_titles[l][o].name,o))}),c("input.ptitle").eq(0).attr("value",WPGlobusAdmin.qedit_titles[l].source)})}},taxonomy_edit:function(){var a=[];a[0]="name",a[1]="description",c.each(WPGlobusCoreData.enabled_languages,function(t,u){c.each(a,function(t,a){var e,o,n,i,l,s,d;o=u,i=c("#"+(e=a)),l=i.clone(),s=i.attr("name"),d="wpglobus-element wpglobus-element_"+e+" wpglobus-element_"+o+" wpglobus-translatable",n=(n=document.getElementById(e)).nodeName,c(l).attr("id",e+"_"+o),c(l).attr("name",s+"_"+o),o!==WPGlobusCoreData.default_language&&(d+=" hidden"),c(l).attr("class",d),c(l).attr("data-save-to",e),c(l).attr("data-language",o),"INPUT"==n?c(l).attr("value",c("#wpglobus-link-tab-"+o).data(e)):"TEXTAREA"==n&&c(l).text(c("#wpglobus-link-tab-"+o).data(e)),i.addClass("hidden"),0==c(".wpglobus-element_"+e).size()?c(l).insertAfter(i):c(l).insertAfter(c(".wpglobus-element_"+e).last())})}),c(".wpglobus-taxonomy-tabs").insertAfter("#ajax-response"),c(".wrap").tabs(),c("body").on("click",".wpglobus-taxonomy-tabs li",function(t){var a=c(this).data("language");c(".wpglobus-element").addClass("hidden"),c(".wpglobus-element_"+a).removeClass("hidden")}),c(".wpglobus-element").on("change",function(){var n=c(this).data("save-to"),i="";c(".wpglobus-element").each(function(t,a){var e=c(a),o=e.val();e.data("save-to")==n&&""!==o&&(i+=WPGlobusCore.addLocaleMarks(o,e.data("language")))}),c("#"+n).val(i)})},nav_menus:function(){var e,o,n="#menu-to-edit .menu-item",i=function(){o!==c(n).size()&&(clearInterval(e),c(n).each(function(t,a){var e=c(a);if(!e.hasClass("wpglobus-menu-item")){var l=c(a).attr("id");c.each(["input.edit-menu-item-title","input.edit-menu-item-attr-title"],function(t,a){var e=c("#"+l+" "+a),o=c(e);if(!o.hasClass("wpglobus-hidden")){o.addClass("wpglobus-hidden"),o.css("display","none");var n=o.parent("label"),i=o.parents("p");c(i).css("height","80px"),c(n).append('<div style="color:#f00;">'+WPGlobusAdmin.i18n.save_nav_menu+"</div>")}}),e.addClass("wpglobus-menu-item")}}))};c.ajaxSetup({beforeSend:function(t,a){void 0!==a.data&&0<=a.data.indexOf("action=add-menu-item")&&(o=c(n).size(),e=setInterval(i,500))}}),c(n).each(function(t,a){var e=c(a).attr("id"),u=e.replace("menu-item-","");c.each(["input.edit-menu-item-title","input.edit-menu-item-attr-title"],function(n,i){var l=c("#"+e+" "+i);l.val()!=WPGlobusAdmin.data.items[u][i].source&&l.val(WPGlobusAdmin.data.items[u][i].source);var s=c("#"+e+" "+i).parents("p"),d=0;c.each(WPGlobusAdmin.data.open_languages,function(t,a){var e=l.clone();e.attr("id",l.attr("id")+"-"+a),e.attr("name",l.attr("id")+"-"+a),e.attr("data-language",a),e.attr("data-item-id",u),e.attr("placeholder",WPGlobusAdmin.data.en_language_name[a]);var o=WPGlobusAdmin.data.items[u][a][i].class;0===n&&a===WPGlobusAdmin.data.default_language?e.attr("class",o+" edit-menu-item-title"):e.attr("class",o),""!=WPGlobusAdmin.data.items[u][a][i].caption?e.attr("value",WPGlobusAdmin.data.items[u][a][i].caption):e.attr("value",""),e.css("margin-bottom","0.6em"),c(s).append(e),d=t}),d=40*(d+1),l.css("display","none").attr("class","").addClass("widefat wpglobus-hidden"),c(s).css("height",d+"px").addClass("wpglobus-menu-item-box")}),c(a).addClass("wpglobus-menu-item")}),c(".menus-move-left, .menus-move-right").each(function(t,a){var e,o=c(a),n=(o.parents("li").attr("id").replace("menu-item-",""),o.attr("title"));void 0!==n&&c.each(WPGlobusAdmin.data.post_titles,function(t,a){0<=n.indexOf(t)&&(e=n.replace(t,a),o.attr("title",e),o.text(e))})}),c(".edit-menu-item-title").trigger("change"),wpNavMenu.refreshAdvancedAccessibility(),wpNavMenu.menusChanged=!1,c(".wpglobus-menu-item").on("change",function(){var t,a,e=c(this),o=e.data("item-id");e.hasClass("wpglobus-item-title")&&(t=WPGlobusCore.getString(c("input#edit-menu-item-title-"+o).val(),e.val(),e.data("language")),void 0!==(a=c(document).triggerHandler("wpglobus_get_menu_translations",{string:t,lang:WPGlobusCoreData.open_languages,id:o,type:"input.edit-menu-item-title"}))&&(t=a),c("input#edit-menu-item-title-"+o).val(t)),e.hasClass("wpglobus-item-attr")&&(t=WPGlobusCore.getString(c("input#edit-menu-item-attr-title-"+o).val(),e.val(),e.data("language")),void 0!==(a=c(document).triggerHandler("wpglobus_get_menu_translations",{string:t,lang:WPGlobusCoreData.open_languages,id:o,type:"input.edit-menu-item-attr-title"}))&&(t=a),c("input#edit-menu-item-attr-title-"+o).val(t))})},post_edit:function(){c(document).on("heartbeat-send",function(t,o){void 0!==o.wp_autosave&&(o.wpglobus_heartbeat="wpglobus",c.each(WPGlobusAdmin.data.open_languages,function(t,a){var e=c("#title_"+a).val()||"";""!=(e=c.trim(e))&&(o.wp_autosave["post_title_"+a]=e),e=c("#content_"+a).val()||"",""!=(e=c.trim(e))&&(o.wp_autosave["content_"+a]=e)}))});var e="#postdivrich",o=!0,a="#post-body-content";if(!1===WPGlobusAdmin.data.support.editor&&(e="#titlediv",o=!1),!1===WPGlobusAdmin.data.support.title&&(o=!1),c(a).prepend(c(".wpglobus-post-body-tabs-list")),c.each(WPGlobusAdmin.tabs,function(t,a){"default"===a?(c(e).wrap('<div id="tab-default"></div>'),o&&c(c("#titlediv")).insertBefore(e)):(c(e+"-"+a).wrap('<div id="tab-'+a+'"></div>'),o&&c(c("#titlediv-"+a)).insertBefore(e+"-"+a))}),c(a).addClass("wpglobus-post-body-tabs").tabs({beforeActivate:function(t,a){var e=a.oldTab[0].id.replace("link-tab-",""),o=a.newTab[0].id.replace("link-tab-","");"default"==e&&(e=WPGlobusCoreData.default_language),"default"==o&&(o=WPGlobusCoreData.default_language);var n=c(document).triggerHandler("wpglobus_post_body_tabs",[e,o]);return!(!n&&void 0!==n)}}),c("#title").val(WPGlobusAdmin.title),c("#content").text(WPGlobusAdmin.content),"undefined"!=typeof WPGlobusVendor&&WPGlobusVendor.vendor.WPSEO&&("undefined"!=typeof wpglobus_wpseo?wpglobus_wpseo():"undefined"!=typeof WPGlobusYoastSeo&&WPGlobusYoastSeo.init()),WPGlobusAdmin.data.modify_excerpt){var n=c("#excerpt");n.addClass("hidden").css({display:"none"}),c(WPGlobusAdmin.data.template).insertAfter(n),c("body").on("change",".wpglobus-excerpt",function(){var t=c(this);n.val(WPGlobusCore.getString(n.val(),t.val(),t.data("language")))})}if(void 0!==wp.utils&&void 0!==wp.utils.WordCounter){WPGlobusCoreData.wordCounter={};var i=this;c.each(WPGlobusCoreData.enabled_languages,function(t,a){if(a==WPGlobusCoreData.default_language)return!0;var e,o,n;e=jQuery,o=new wp.utils.WordCounter,n=a,WPGlobusCoreData.wordCounter[n]={},WPGlobusCoreData.wordCounter[n].counter=o,e(function(){function o(t){var a,e;"object"==typeof t&&(t="tinymce"==t?i.getCurrentTab():t.target.id.replace("content_","")),void 0!==WPGlobusCoreData.wordCounter[t]&&(a=!WPGlobusCoreData.wordCounter[t].contentEditor||WPGlobusCoreData.wordCounter[t].contentEditor.isHidden()?WPGlobusCoreData.wordCounter[t].content.val():WPGlobusCoreData.wordCounter[t].contentEditor.getContent({format:"raw"}),(e=WPGlobusCoreData.wordCounter[t].counter.count(a))!==WPGlobusCoreData.wordCounter[t].prevCount&&WPGlobusCoreData.wordCounter[t].count.text(e),WPGlobusCoreData.wordCounter[t].prevCount=e)}WPGlobusCoreData.wordCounter[n].content=e("#content_"+n),WPGlobusCoreData.wordCounter[n].count=e("#wp-word-count-"+n).find(".word-count-"+n),WPGlobusCoreData.wordCounter[n].prevCount=0,e(document).on("tinymce-editor-init",function(t,a){if(-1!=a.id.indexOf("content_")){var e=a.id.replace("content_","");(WPGlobusCoreData.wordCounter[e].contentEditor=a).on("nodechange keyup",_.debounce(o,1e3))}}),WPGlobusCoreData.wordCounter[n].content.on("input keyup",_.debounce(o,1e3)),o(n)})})}if("undefined"!=typeof wpWordCount){var l=0,t=WPGlobusCoreData.open_languages,s=this.$document,d={};t.shift(),c.each(WPGlobusCoreData.open_languages,function(t,a){d[a]=0});var u={settings:{strip:/<[a-zA-Z\/][^<>]*>/g,clean:/[0-9.(),;:!?%#$¿'"_+=\\/-]+/g,w:/\S\s+/g,c:/\S/g},block:d,wc:function(t,a,e){var o,n=this,i=0;o=a==WPGlobusCoreData.default_language?c(".word-count"):c(".word-count-"+a),void 0===e&&(e=wordCountL10n.type),"w"!==e&&"c"!==e&&(e="w"),n.block[a]||(n.block[a]=1,setTimeout(function(){t&&(t=(t=t.replace(n.settings.strip," ").replace(/&nbsp;|&#160;/gi," ")).replace(n.settings.clean,"")).replace(n.settings[e],function(){i++}),o.html(i.toString()),setTimeout(function(){n.block[a]=0},2e3)},1))}};s.bind("wpglobuscountwords",function(t,a,e){u.wc(a,e)}),c.each(t,function(t,e){var o=c("#content_"+e);s.triggerHandler("wpglobuscountwords",[o.val(),e]),o.keyup(function(t){var a=t.keyCode||t.charCode;return a==l||(13!=a&&8!=l&&46!=l||s.triggerHandler("wpglobuscountwords",[o.val(),e]),l=a),!0})}),c(document).triggerHandler("wpglobuscountwords",[c("#content").val(),WPGlobusCoreData.default_language])}c("body").on("click","#publish, #save-post",function(){if(1<WPGlobusAdmin.data.open_languages.length){c(document).triggerHandler("wpglobus_before_save_post",{content_tabs_id:a});var t,e=c("#title").val(),o="",n="";0==e.length&&(t=WPGlobusAdmin.data.open_languages.indexOf(WPGlobusAdmin.data.default_language),WPGlobusAdmin.data.open_languages.splice(t,1),c(WPGlobusAdmin.data.open_languages).each(function(t,a){n=0==t?"":"-",0<(e=c("#title_"+a).val()).length&&(0==o.length&&(n=""),o=o+n+e)})),0<o.length&&c("#title").val(o)}void 0===WPGlobusAdmin.data.tagsdiv||WPGlobusAdmin.data.tagsdiv.length<1||c(WPGlobusAdmin.data.tagsdiv).each(function(t,a){if(0==c("#"+a).size())return!0;var e=a.replace("tagsdiv-","");if("undefined"===e)return!0;if(0==c("#tax-input-"+e).size())return!0;var o,n=[];c("#tagsdiv-"+e+" .tagchecklist span").each(function(t,a){o=(o=c(a).text()).replace("X","").trim(" "),void 0===WPGlobusAdmin.data.tag[e][o]?n[t]=o:n[t]=WPGlobusAdmin.data.tag[e][o]}),c("#tax-input-"+e).val(n.join(", "))})}),c(".ui-state-default").on("click",function(){"link-tab-default"===c(this).attr("id")&&(c(window).scrollTop(c(window).scrollTop()+1),c(window).scrollTop(c(window).scrollTop()-1))})},adminCentral:function(){c(".wpglobus-admin-central-tab").css({display:"none"}),1<c(".nav-tab-active").length&&c(".wpglobus-about-wrap .nav-tab-wrapper a").removeClass("nav-tab-active");var e=!0;0==location.hash.indexOf("#")&&c(".wpglobus-about-wrap .nav-tab-wrapper a").each(function(t,a){c(a).attr("href")==location.hash&&(e=!1,c(a).addClass("nav-tab-active"))}),e&&c(".wpglobus-about-wrap .nav-tab-wrapper a").eq(0).addClass("nav-tab-active");var t=c(".wpglobus-about-wrap .nav-tab-active").data("tab-id");""!=t&&c("#"+t).css({display:"block"}),c(document).on("click",".wpglobus-about-wrap .nav-tab",function(t){var a=c(this);a.hasClass("nav-tab-active")||(c(".wpglobus-admin-central-tab").css({display:"none"}),c(".wpglobus-about-wrap .nav-tab").removeClass("nav-tab-active"),a.addClass("nav-tab-active"),""!=a.data("tab-id")&&c("#"+a.data("tab-id")).css({display:"block"}))})},start:function(){var a=this;c("#wpglobus_flags").select2({formatResult:this.format,formatSelection:this.format,minimumResultsForSearch:-1,escapeMarkup:function(t){return t}}),c("body").on("click","#enabled_languages-list li:first input",function(t){return t.preventDefault(),c(".redux-save-warn").css({display:"none"}),c("#enabled_languages-list").find("li:first > input").val("1"),0===c("#disable_first_language").length&&c(a.config.disable_first_language).insertAfter("#info_bar"),!1})},format:function(t){return'<img class="wpglobus_flag" src="'+WPGlobusAdmin.flag_url+t.text+'"/>&nbsp;&nbsp;'+t.text},set_dialog:function(){if(void 0===WPGlobusAdmin.data.customFieldsEnabled||(WPGlobusAdmin.data.customFieldsEnabled=this.parseBool(WPGlobusAdmin.data.customFieldsEnabled),WPGlobusAdmin.data.customFieldsEnabled)){var o,a=!1,n=function(t){var s,d,u,r="wpglobus_dialog_start wpglobus_dialog_icon";u=['<div class="wpglobus_dialog_options_wrapper hidden">','<input style="width:initial;" id="wpglobus-cb-{{id}}" data-object="#wpglobus-dialog-start-{{id}}" data-meta-key="{{meta-key}}" class="wpglobus_dialog_option wpglobus_dialog_cb" type="checkbox" {{checked}} />',"</div>"].join(""),c(void 0===t?"#the-list tr":"#the-list tr#"+t).each(function(){var t,a,e,o=c(this),n=o.attr("id"),i=o.find("textarea"),l=r;if(void 0===(s=i.attr("id")))return!0;e=c("#"+n+"-key").val(),t=c("#"+s).clone(),c(i).addClass("wpglobus-dialog-field-source hidden"),a=i.attr("name"),c(t).attr("id","wpglobus-"+s),c(t).attr("name","wpglobus-"+a),c(t).attr("data-source-id",s),c(t).attr("class","wpglobus-dialog-field"),c(t).val(WPGlobusCore.TextFilter(c(i).val(),WPGlobusCoreData.language)),c(t).insertAfter(i),d=(d=u.replace(/{{id}}/g,s)).replace(/{{meta-key}}/g,e),void 0===WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type]?d=d.replace(/{{checked}}/,"checked"):void 0!==WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][e]&&"false"==WPGlobusAdmin.data.post_meta_settings[WPGlobusAdmin.data.post_type][e]?(d=d.replace(/{{checked}}/,""),l=r+" wpglobus_dialog_start_hidden"):(d=d.replace(/{{checked}}/,"checked"),l=r),o.append('<td style="width:20px;"><div id="wpglobus-dialog-start-'+s+'" data-type="control" data-source-type="textarea" data-source-id="'+s+'" class="'+l+'"></div>'+d+"</td>")}),!a&&0<c("#list-table .wpglobus_dialog_start").length&&(c("#list-table thead tr").append('<th class="wpglobus-control-head"><div class="wpglobus_dialog_settings wpglobus_dialog_icon"></div></th>'),a=!0)};n(),c("body").on("change",".wpglobus-dialog-field",function(){var e,o,n=c(this),t="#"+n.data("source-id"),i="";void 0!==t&&(e=c(t).val(),/(\{:|\[:|<!--:)[a-z]{2}/.test(e)?(c.each(WPGlobusCoreData.enabled_languages,function(t,a){""!=(o=a==WPGlobusCoreData.language?n.val():WPGlobusCore.TextFilter(e,a,"RETURN_EMPTY"))&&(i+=WPGlobusCore.addLocaleMarks(o,a))}),c(t).val(i)):c(t).val(n.val()))}),c(document).ajaxSend(function(t,a,e){"add-meta"==e.action&&(o=e.element)}),c(document).ajaxComplete(function(t,a,e){"add-meta"==e.action&&void 0!==a.responseXML&&n("newmeta"==o?"meta-"+c(a.responseXML.documentElement.outerHTML).find("meta").attr("id"):o)}),WPGlobusDialogApp.init({dialogTitle:"Edit meta"})}}},new t.App,t)});
includes/js/wpglobus-clean.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){"use strict";if("undefined"!=typeof WPGlobusClean&&"undefined"!=typeof WPGlobusAdmin){var n={init:function(){n.addListeners()},addListeners:function(o){e("#wpglobus-clean-activate").on("click",function(n){e("#wpglobus-clean-button").toggleClass("hidden")}),e("#wpglobus-clean-button").one("click",function(o){e(this).toggleClass("hidden"),e("#wpglobus-clean-activate").prop("checked",""),n.clean()})},beforeSend:function(n){void 0!==n.table&&e("#"+n.table+" .wpglobus-spinner").css({visibility:"visible"})},clean:function(){WPGlobusClean.tables;var o=e.when();e.each(WPGlobusClean.data,function(l,t){o=o.then(function(){var o={};return o.log=e("#wpglobus-clean-log").prop("checked"),"wpglobus_options"==l?e("#cb-wpglobus_options").prop("checked")?(o.action="wpglobus-reset",o.table=l):o.action="die":(o.action="clean",o.table=l),e.ajax({beforeSend:function(){void 0!==n.beforeSend&&n.beforeSend(o)},type:"POST",url:WPGlobusAdmin.ajaxurl,data:{action:WPGlobusAdmin.process_ajax,order:o},dataType:"json"})},function(){}).then(function(n){void 0!==n.data&&(e("#"+n.data.table+" .wpglobus-spinner").css({visibility:"hidden"}),n.success?e("#"+n.data.table+" .wpglobus-result").html('<img src="'+WPGlobusClean.icons.success+'" />'):e("#"+n.data.table+" .wpglobus-result").html('<img src="'+WPGlobusClean.icons.error+'" />'))})}),o.then(function(){e(".wpglobus-clean-box").addClass("hidden"),e("#cb-wpglobus_options").attr("disabled","disabled")})}};WPGlobusClean=e.extend({},WPGlobusClean,n),WPGlobusClean.init()}});
1
+ jQuery(document).ready(function(l){"use strict";if("undefined"!=typeof WPGlobusClean&&"undefined"!=typeof WPGlobusAdmin){var t={init:function(){t.addListeners()},addListeners:function(e){l("#wpglobus-clean-activate").on("click",function(e){l("#wpglobus-clean-button").toggleClass("hidden")}),l("#wpglobus-clean-button").one("click",function(e){l(this).toggleClass("hidden"),l("#wpglobus-clean-activate").prop("checked",""),t.clean()})},beforeSend:function(e){void 0!==e.table&&l("#"+e.table+" .wpglobus-spinner").css({visibility:"visible"})},clean:function(){WPGlobusClean.tables;var o=l.when();l.each(WPGlobusClean.data,function(n,e){o=o.then(function(){var e={};return e.log=l("#wpglobus-clean-log").prop("checked"),"wpglobus_options"==n?l("#cb-wpglobus_options").prop("checked")?(e.action="wpglobus-reset",e.table=n):e.action="die":(e.action="clean",e.table=n),l.ajax({beforeSend:function(){void 0!==t.beforeSend&&t.beforeSend(e)},type:"POST",url:WPGlobusAdmin.ajaxurl,data:{action:WPGlobusAdmin.process_ajax,order:e},dataType:"json"})},function(){}).then(function(e){void 0!==e.data&&(l("#"+e.data.table+" .wpglobus-spinner").css({visibility:"hidden"}),e.success?l("#"+e.data.table+" .wpglobus-result").html('<img src="'+WPGlobusClean.icons.success+'" />'):l("#"+e.data.table+" .wpglobus-result").html('<img src="'+WPGlobusClean.icons.error+'" />'))})}),o.then(function(){l(".wpglobus-clean-box").addClass("hidden"),l("#cb-wpglobus_options").attr("disabled","disabled")})}};WPGlobusClean=l.extend({},WPGlobusClean,t),WPGlobusClean.init()}});
includes/js/wpglobus-customize-control.min.js CHANGED
@@ -1 +1 @@
1
- var WPGlobusCustomize;jQuery(document).ready(function(e){"use strict";if(void 0!==WPGlobusCoreData.customize){var t={languages:{},index:0,length:0,positionSet:!1,selectorHtml:'<span style="margin-left:5px;" class="wpglobus-icon-globe"></span><span style="font-weight:bold;">{{language}}</span>',init:function(o){e.each(WPGlobusCoreData.enabled_languages,function(e,o){t.languages[e]=o,t.length=e}),t.addLanguageSelector(),t.setElements(),t.addListeners()},setTitle:function(){e(WPGlobusCoreData.customize.info.element).html(WPGlobusCoreData.customize.info.html)},getString:function(t){var o=WPGlobusCore.getTranslations(t),a=[],s=0;return e.each(o,function(e,t){a[s]=""==t?"null":t,s++}),a=a.join(":::")},setElements:function(){t.setTitle();var o;e.each(WPGlobusCoreData.customize.addElements,function(a,s){var n=e(s.element);n.attr("id",a).val(s.value).trigger("change"),"textarea"==s.type&&void 0!==s.textarea_attrs&&n.addClass(s.textarea_attrs.class),void 0!==s.options&&(void 0!==s.options.setValue&&s.options.setValue&&(o=e(s.origin_element).val(),n.data("source",o),n.val(WPGlobusCore.TextFilter(o,WPGlobusCoreData.language,"RETURN_EMPTY")),n.hasClass("wpglobus-control-url")&&e(s.origin_element).val(t.getString(o))),void 0!==s.options.setLabel&&s.options.setLabel&&(e(s.title).text(e(s.origin_title).text()),e(s.description).text(e(s.origin_description).text()))),n.on("change",function(o){var a=e(this),s=e(WPGlobusCoreData.customize.addElements[e(this).data("customize-setting-link")].origin_element);a.data("source",WPGlobusCore.getString(a.data("source"),a.val())),a.hasClass("wpglobus-control-url")?s.val(t.getString(a.data("source"))):s.val(WPGlobusCore.getString(s.val(),a.val())),a.hasClass("wpglobus-not-trigger-change")||s.trigger("change")})})},addLanguageSelector:function(){e('<a style="margin-left:48px;" class="customize-controls-close wpglobus-customize-selector"><span class="wpglobus-globe"></span></a>').insertAfter(".customize-controls-preview-toggle"),e(".wpglobus-customize-selector").html(t.selectorHtml.replace("{{language}}",WPGlobusCoreData.language))},setPosition:function(t){if(void 0!==t.options.setPosition&&t.options.setPosition){e(t.parent).detach().insertBefore(t.origin_parent),e(t.parent).css({display:"block"})}},addListeners:function(){e(document).on("click",".control-section",function(o){t.positionSet||(t.positionSet=!0,e.each(WPGlobusCoreData.customize.addElements,function(o,a){e(a.origin_parent).css({display:"none"}),e(a.origin_parent+" label").css({display:"none"}),void 0!==a.options&&t.setPosition(a)}))}),e(document).on("click",".wpglobus-customize-selector",function(o){t.index>t.length-1?t.index=0:t.index++,WPGlobusCoreData.language=t.languages[t.index],e(this).html(t.selectorHtml.replace("{{language}}",WPGlobusCoreData.language)),e(".wpglobus-customize-control").each(function(t,o){if(void 0!==WPGlobusCoreData.customize.addElements[e(o).data("customize-setting-link")]){var a=e(WPGlobusCoreData.customize.addElements[e(o).data("customize-setting-link")].origin_element),s=e(o);s.hasClass("wpglobus-control-url")?s.val(WPGlobusCore.TextFilter(s.data("source"),WPGlobusCoreData.language,"RETURN_EMPTY")):s.val(WPGlobusCore.TextFilter(a.val(),WPGlobusCoreData.language,"RETURN_EMPTY"))}})}),e(document).ajaxSend(function(t,o,a){if(void 0!==a.data&&a.data.indexOf("action=customize_save")>=0){var s,n,i=a.data.split("&");e.each(i,function(e,t){"customized"!=(s=t.split("="))[0]||(n=s[1])});var l=decodeURIComponent(n);l=JSON.parse(l),e.each(WPGlobusCoreData.customize.addElements,function(t,o){void 0!==l[t]&&(l[o.origin]=e(WPGlobusCoreData.customize.addElements[t].origin_element).val())}),a.data=a.data.replace(n,JSON.stringify(l))}})}};(WPGlobusCustomize=e.extend({},WPGlobusCustomize,t)).init()}});
1
+ var WPGlobusCustomize;jQuery(document).ready(function(l){"use strict";if(void 0!==WPGlobusCoreData.customize){var s={languages:{},index:0,length:0,positionSet:!1,selectorHtml:'<span style="margin-left:5px;" class="wpglobus-icon-globe"></span><span style="font-weight:bold;">{{language}}</span>',init:function(e){l.each(WPGlobusCoreData.enabled_languages,function(e,t){s.languages[e]=t,s.length=e}),s.addLanguageSelector(),s.setElements(),s.addListeners()},setTitle:function(){l(WPGlobusCoreData.customize.info.element).html(WPGlobusCoreData.customize.info.html)},getString:function(e){var t=WPGlobusCore.getTranslations(e),o=[],a=0;return l.each(t,function(e,t){o[a]=""==t?"null":t,a++}),o=o.join(":::")},setElements:function(){var a;s.setTitle(),l.each(WPGlobusCoreData.customize.addElements,function(e,t){var o=l(t.element);o.attr("id",e).val(t.value).trigger("change"),"textarea"==t.type&&void 0!==t.textarea_attrs&&o.addClass(t.textarea_attrs.class),void 0!==t.options&&(void 0!==t.options.setValue&&t.options.setValue&&(a=l(t.origin_element).val(),o.data("source",a),o.val(WPGlobusCore.TextFilter(a,WPGlobusCoreData.language,"RETURN_EMPTY")),o.hasClass("wpglobus-control-url")&&l(t.origin_element).val(s.getString(a))),void 0!==t.options.setLabel&&t.options.setLabel&&(l(t.title).text(l(t.origin_title).text()),l(t.description).text(l(t.origin_description).text()))),o.on("change",function(e){var t=l(this),o=l(WPGlobusCoreData.customize.addElements[l(this).data("customize-setting-link")].origin_element);t.data("source",WPGlobusCore.getString(t.data("source"),t.val())),t.hasClass("wpglobus-control-url")?o.val(s.getString(t.data("source"))):o.val(WPGlobusCore.getString(o.val(),t.val())),t.hasClass("wpglobus-not-trigger-change")||o.trigger("change")})})},addLanguageSelector:function(){l('<a style="margin-left:48px;" class="customize-controls-close wpglobus-customize-selector"><span class="wpglobus-globe"></span></a>').insertAfter(".customize-controls-preview-toggle"),l(".wpglobus-customize-selector").html(s.selectorHtml.replace("{{language}}",WPGlobusCoreData.language))},setPosition:function(e){void 0!==e.options.setPosition&&e.options.setPosition&&(l(e.parent).detach().insertBefore(e.origin_parent),l(e.parent).css({display:"block"}))},addListeners:function(){l(document).on("click",".control-section",function(e){s.positionSet||(s.positionSet=!0,l.each(WPGlobusCoreData.customize.addElements,function(e,t){l(t.origin_parent).css({display:"none"}),l(t.origin_parent+" label").css({display:"none"}),void 0!==t.options&&s.setPosition(t)}))}),l(document).on("click",".wpglobus-customize-selector",function(e){s.index>s.length-1?s.index=0:s.index++,WPGlobusCoreData.language=s.languages[s.index],l(this).html(s.selectorHtml.replace("{{language}}",WPGlobusCoreData.language)),l(".wpglobus-customize-control").each(function(e,t){if(void 0!==WPGlobusCoreData.customize.addElements[l(t).data("customize-setting-link")]){var o=l(WPGlobusCoreData.customize.addElements[l(t).data("customize-setting-link")].origin_element),a=l(t);a.hasClass("wpglobus-control-url")?a.val(WPGlobusCore.TextFilter(a.data("source"),WPGlobusCoreData.language,"RETURN_EMPTY")):a.val(WPGlobusCore.TextFilter(o.val(),WPGlobusCoreData.language,"RETURN_EMPTY"))}})}),l(document).ajaxSend(function(e,t,o){if(void 0!==o.data&&0<=o.data.indexOf("action=customize_save")){var a,s,n=o.data.split("&");l.each(n,function(e,t){"customized"!=(a=t.split("="))[0]||(s=a[1])});var i=decodeURIComponent(s);i=JSON.parse(i),l.each(WPGlobusCoreData.customize.addElements,function(e,t){void 0!==i[e]&&(i[t.origin]=l(WPGlobusCoreData.customize.addElements[e].origin_element).val())}),o.data=o.data.replace(s,JSON.stringify(i))}})}};(WPGlobusCustomize=l.extend({},WPGlobusCustomize,s)).init()}});
includes/js/wpglobus-customize-control140.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(t){"use strict";var e={languages:{},index:0,length:0,controlInstances:{},controlWidgets:{},instancesKeep:!1,widgetKeep:!1,action:!1,selectorHtml:'<span style="margin-left:5px;" class="wpglobus-icon-globe"></span><span style="font-weight:bold;">{{language}}</span>',init:function(o){e.setTitle(),"false"!=WPGlobusCustomizeOptions.themeEnabled&&(t.each(WPGlobusCoreData.enabled_languages,function(t,o){e.languages[t]=o,e.length=t}),e.addLanguageSelector(),e.setControlInstances(),e.setFieldsSection(),e.attachListeners())},setFieldsSection:function(){var e={},o=t(".wpglobus-fields_settings_control_box").data("section-template"),n="",s="",l="";t.each(WPGlobusCustomize.controlInstances,function(t,o){void 0===e[o.section]&&(e[o.section]={}),e[o.section][t]=o}),t.each(e,function(e,i){s="<ul>",t.each(i,function(t,e){l=e.userControl.enabled?" checked ":"",s+='<li><input id="wpglobus-cb-control-'+t+'" data-control="'+t+'" class="wpglobus-customize-cb-control" type="checkbox"'+l+" /> "+e.title+"</li>"}),s+="</ul>",n=(n=(n=(n=o.replace("{{section_title}}",wp.customize.section(e).params.title)).replace(/{{section}}/g,e)).replace("{{section_id}}",'"'+e+'"')).replace("{{items}}",s),t(n).insertBefore(t("#"+WPGlobusCustomizeOptions.userControlSaveButton))}),t("#accordion-section-wpglobus_fields_settings_section").css({"margin-top":"15px"}),t(WPGlobusCustomizeOptions.helpButton).insertAfter(t("#accordion-section-wpglobus_fields_settings_section .customize-action")),t("#accordion-section-wpglobus_fields_settings_section .customize-section-description").addClass("hidden"),t("."+WPGlobusCustomizeOptions.userControlIconClass).on("click",function(e){var o=t(this).data("section");t(WPGlobusCustomizeOptions.userControlBoxSelector).each(function(e,n){o==t(n).data("section")?t(this).css({display:"block"}):t(this).css({display:"none"})}),wp.customize.control("wpglobus_fields_settings_section").expand()}),t(".wpglobus-customize-icon-help.customize-help-toggle").on("click",function(e){t("#accordion-section-wpglobus_fields_settings_section .customize-section-description").toggleClass("hidden")})},setUserControls:function(e,o){var n=o.controlSelector+" "+o.selector,s='<img class="'+WPGlobusCustomizeOptions.userControlIconClass+'" data-section="'+o.section+'" style="position:absolute;right:0px;" src="'+WPGlobusCustomizeOptions.userControlIcon+'" />';t(s).insertBefore(n),o.userControl.enabled||(t(n).length>1?t(n).each(function(e,o){t(o).removeClass(WPGlobusCustomize.controlClass)}):t(n).removeClass(WPGlobusCustomize.controlClass).val(o.setting))},ctrlMenuItemsCallback:function(t,e){},ctrlWidgetCallback:function(o,n){if(e.action=!1,void 0===e.controlWidgets[o].element){void 0===n&&(n=wp.customize.control.instance(o)),e.controlWidgets[o].element={},e.controlWidgets[o].control=n,e.controlWidgets[o].inWidgetTitle=n.container.find(".in-widget-title");var s=n.container.find("input[type=submit]");0!=s.length&&(s.css({display:"block"}),s.attr("data-widget",o),e.controlWidgets[o].submit=s,e.attachWidgetListeners(e.controlWidgets[o])),n.liveUpdateMode=!1,void 0===n.setting().title?e.controlWidgets[o].inWidgetTitle.text(""):e.controlWidgets[o].inWidgetTitle.text(": "+WPGlobusCore.TextFilter(n.setting().title,WPGlobusCustomize.languageAdmin)),t.each(WPGlobusCustomize.elementSelector,function(s,l){var i=n.container.find(l);0!=i.length&&t.each(i,function(s,a){if(void 0===a.id||""==a.id)return!0;var c=t(i[s]);void 0===e.controlWidgets[o].element[a.id]&&(e.controlWidgets[o].element[a.id]={}),c.addClass("wpglobus-customize-widget-control"),c.attr("data-widget",o),e.controlWidgets[o].element[a.id].element=c,e.controlWidgets[o].element[a.id].setting=n.setting(),e.controlWidgets[o].element[a.id].selector=l,e.controlWidgets[o].element[a.id].value=a.defaultValue,c.val(WPGlobusCore.TextFilter(a.defaultValue,WPGlobusCoreData.language,"RETURN_EMPTY"))})}),t(document).triggerHandler("wpglobus_customize_control_added_widget",[o])}},ctrlCallback:function(o,n,s){var l=!1;if(t.each(WPGlobusCustomize.disabledSections,function(t,e){if(o.section()==e)return l=!0,!1}),!l&&(t.each(WPGlobusCustomize.disabledSettingMask,function(t,e){if(n.indexOf(e)>=0)return l=!0,!1}),!l)){var i=wp.customize.control.instance(n);if(n.indexOf("widget")>=0)return void 0===e.controlWidgets[n]&&(e.controlWidgets[n]={},e.action&&e.ctrlWidgetCallback(n,i)),e.controlWidgets[n].parent=i.selector,!1;if(void 0===e.controlInstances[n]){var a=!0;t.each(WPGlobusCustomize.elementSelector,function(o,s){var l=i.container.find(s);0!=l.length&&(e.controlInstances[n]={},e.controlInstances[n].element=l,e.controlInstances[n].setting=i.setting(),e.controlInstances[n].selector=s,e.controlInstances[n].controlSelector=i.selector,e.controlInstances[n].type="",e.controlInstances[n].section=i.section(),e.controlInstances[n].title=null,e.controlInstances[n].userControl=null,t.each(WPGlobusCustomize.setLinkBy,function(t,o){n.indexOf(o)>=0&&(e.controlInstances[n].type="link",""==e.controlInstances[n].setting&&(e.controlInstances[n].setting=l[0].defaultValue),l.addClass("wpglobus-control-link"))}),""===e.controlInstances[n].type&&(e.controlInstances[n].type="textarea"==s?"textarea":"text"),l.val(WPGlobusCore.TextFilter(e.controlInstances[n].setting,WPGlobusCoreData.language,"RETURN_EMPTY")),l.addClass("wpglobus-customize-control"),l.attr("data-wpglobus-customize-control",e.controlInstances[n].controlSelector.replace("#customize-control-","")),"link"==e.controlInstances[n].type&&(e.controlInstances[n].setting=e.convertString(l[0].defaultValue)),e.controlInstances[n].title=t(i.selector+" .customize-control-title").text(),null!==WPGlobusCustomizeOptions.userControl&&void 0!==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName]&&void 0!==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName][n]&&"disable"==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName][n]&&(a=!1),e.controlInstances[n].userControl={},e.controlInstances[n].userControl.enabled=a,e.setUserControls(n,e.controlInstances[n]))})}}},setControlInstances:function(){wp.customize.control.each(e.ctrlCallback)},setTitle:function(){t(WPGlobusCoreData.customize.info.element).html(WPGlobusCoreData.customize.info.html)},convertString:function(e){if(void 0===e)return e;var o=[],n=WPGlobusCore.getTranslations(e),s=0,l=!0;return t.each(n,function(t,e){""==e?o[s]="null":(l=!1,o[s]=e),s++}),l?"":o.join("|||")},getTranslations:function(e){var o={},n=e.split("|||");return t.each(WPGlobusCoreData.enabled_languages,function(t,e){o[e]="undefined"===n[t]||"null"===n[t]?"":n[t]}),o},getString:function(o,n,s){if(void 0===o)return o;void 0===n&&(n=""),void 0===s&&(s=WPGlobusCoreData.language);var l=e.getTranslations(o),i=[],a=0;return t.each(l,function(t,e){i[a]=t==s?n:""==e?"null":e,a++}),i=i.join("|||")},addLanguageSelector:function(){t(WPGlobusCustomize.selectorButton).insertAfter(".customize-controls-preview-toggle"),t(".wpglobus-customize-selector").html(e.selectorHtml.replace("{{language}}",WPGlobusCoreData.language)),t(document).on("click",".wpglobus-customize-selector",function(o){e.index>e.length-1?e.index=0:e.index++,WPGlobusCoreData.language=e.languages[e.index],t(this).html(e.selectorHtml.replace("{{language}}",WPGlobusCoreData.language)),t(document).triggerHandler("wpglobus_customize_control_language",[WPGlobusCoreData.language]),t(".wpglobus-customize-control").each(function(o,n){var s=t(n),l=s.data("customize-setting-link");if(void 0!==WPGlobusCustomize.controlInstances[l]||(l=s.data("wpglobus-customize-control"),void 0!==WPGlobusCustomize.controlInstances[l]))if(s.hasClass("wpglobus-control-link")){var i=e.getTranslations(WPGlobusCustomize.controlInstances[l].setting);s.val(i[WPGlobusCoreData.language])}else s.val(WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[l].setting,WPGlobusCoreData.language,"RETURN_EMPTY"))}),t(".wpglobus-customize-widget-control").each(function(e,o){var n=t(o),s=n.data("widget");if(void 0===n.attr("id"))return!0;n.val(WPGlobusCore.TextFilter(WPGlobusCustomize.controlWidgets[s].element[n.attr("id")].value,WPGlobusCoreData.language,"RETURN_EMPTY"))})})},updateElements:function(o){void 0===o&&(o=!0),t.each(WPGlobusCustomize.controlInstances,function(t,n){if(!n.userControl.enabled)return!0;var s=wp.customize.control.instance(t);if("link"==n.type){var l=e.getTranslations(WPGlobusCustomize.controlInstances[t].setting);o?(s.setting.set(l[WPGlobusCoreData.language]),n.element.val(s.setting())):n.element.val(l[WPGlobusCoreData.language])}else o?(s.setting.set(WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[t].setting,WPGlobusCoreData.language,"RETURN_EMPTY")),n.element.val(s.setting())):n.element.val(WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[t].setting,WPGlobusCoreData.language,"RETURN_EMPTY"))})},onSubmitEvents:function(o){"mouseenter"==o.type?t.each(e.controlWidgets[t(this).data("widget")].element,function(e,o){t("#"+e).val(o.value)}):"mouseleave"==o.type?e.widgetKeep||t.each(e.controlWidgets[t(this).data("widget")].element,function(e,o){t("#"+e).val(WPGlobusCore.TextFilter(o.value,WPGlobusCoreData.language,"RETURN_EMPTY"))}):"click"==o.type&&(e.widgetKeep=!0)},attachWidgetListeners:function(o){void 0!==o.submit[0].id&&t(document).on("mouseenter","#"+o.submit[0].id,e.onSubmitEvents).on("mouseleave","#"+o.submit[0].id,e.onSubmitEvents).on("click","#"+o.submit[0].id,e.onSubmitEvents)},attachListeners:function(){t(".wpglobus-customize-control").on("keyup",function(o){var n=t(this),s=n.data("customize-setting-link");void 0===WPGlobusCustomize.controlInstances[s]&&(s=n.data("wpglobus-customize-control"),void 0===WPGlobusCustomize.controlInstances[s])||("link"==WPGlobusCustomize.controlInstances[s].type?WPGlobusCustomize.controlInstances[s].setting=e.getString(WPGlobusCustomize.controlInstances[s].setting,n.val(),WPGlobusCoreData.language):WPGlobusCustomize.controlInstances[s].setting=WPGlobusCore.getString(WPGlobusCustomize.controlInstances[s].setting,n.val(),WPGlobusCoreData.language))}),t(document).on("keyup",".wpglobus-customize-widget-control",function(e){var o=t(this),n=o.data("widget");void 0!==WPGlobusCustomize.controlWidgets[n]&&(WPGlobusCustomize.controlWidgets[n].element[o.attr("id")].value=WPGlobusCore.getString(WPGlobusCustomize.controlWidgets[n].element[o.attr("id")].value,o.val(),WPGlobusCoreData.language))}),t("#save").on("mouseenter",function(e){t.each(WPGlobusCustomize.controlInstances,function(t,e){if(e.userControl.enabled){var o=wp.customize.control.instance(t);o.setting.set(e.setting),e.element.val(o.setting())}})}).on("mouseleave",function(t){e.instancesKeep||e.updateElements()}).on("click",function(t){e.instancesKeep=!0}),t(document).on("ajaxComplete",function(o,n){void 0!==n.responseText&&('{"success":true,"data":[]}'==n.responseText?e.updateElements(!1):(n.responseText.indexOf("WP_CUSTOMIZER_SIGNATURE")>=0&&(e.action="customizerAjaxComplete",e.setControlInstances()),t.each(WPGlobusCustomize.controlWidgets,function(o,s){var l=o.replace("_","-");if(n.responseText.indexOf(l)>=0)return s.submit.css({display:"block"}),s.control.liveUpdateMode=!1,t.each(s.element,function(e,o){t("#"+e).val(WPGlobusCore.TextFilter(o.value,WPGlobusCoreData.language,"RETURN_EMPTY"))}),s.inWidgetTitle.text(": "+WPGlobusCore.TextFilter(s.control.setting().title,WPGlobusCustomize.languageAdmin)),e.widgetKeep=!1,!1})))}),t(document).on("click",".widget-title, .widget-title-action",function(o){var n=t(this).parents(".customize-control-widget_form").attr("id");t.each(e.controlWidgets,function(t,o){if("#"+n==o.parent)return e.ctrlWidgetCallback(t),!1})})}};WPGlobusCustomize=t.extend({},WPGlobusCustomize,e),WPGlobusCustomize.init()});
1
+ jQuery(document).ready(function(a){"use strict";var c={languages:{},index:0,length:0,controlInstances:{},controlWidgets:{},instancesKeep:!1,widgetKeep:!1,action:!1,selectorHtml:'<span style="margin-left:5px;" class="wpglobus-icon-globe"></span><span style="font-weight:bold;">{{language}}</span>',init:function(t){c.setTitle(),"false"!=WPGlobusCustomizeOptions.themeEnabled&&(a.each(WPGlobusCoreData.enabled_languages,function(t,e){c.languages[t]=e,c.length=t}),c.addLanguageSelector(),c.setControlInstances(),c.setFieldsSection(),c.attachListeners())},setFieldsSection:function(){var o={},n=a(".wpglobus-fields_settings_control_box").data("section-template"),s="",l="",i="";a.each(WPGlobusCustomize.controlInstances,function(t,e){void 0===o[e.section]&&(o[e.section]={}),o[e.section][t]=e}),a.each(o,function(t,e){l="<ul>",a.each(e,function(t,e){i=e.userControl.enabled?" checked ":"",l+='<li><input id="wpglobus-cb-control-'+t+'" data-control="'+t+'" class="wpglobus-customize-cb-control" type="checkbox"'+i+" /> "+e.title+"</li>"}),l+="</ul>",s=(s=(s=(s=n.replace("{{section_title}}",wp.customize.section(t).params.title)).replace(/{{section}}/g,t)).replace("{{section_id}}",'"'+t+'"')).replace("{{items}}",l),a(s).insertBefore(a("#"+WPGlobusCustomizeOptions.userControlSaveButton))}),a("#accordion-section-wpglobus_fields_settings_section").css({"margin-top":"15px"}),a(WPGlobusCustomizeOptions.helpButton).insertAfter(a("#accordion-section-wpglobus_fields_settings_section .customize-action")),a("#accordion-section-wpglobus_fields_settings_section .customize-section-description").addClass("hidden"),a("."+WPGlobusCustomizeOptions.userControlIconClass).on("click",function(t){var o=a(this).data("section");a(WPGlobusCustomizeOptions.userControlBoxSelector).each(function(t,e){o==a(e).data("section")?a(this).css({display:"block"}):a(this).css({display:"none"})}),wp.customize.control("wpglobus_fields_settings_section").expand()}),a(".wpglobus-customize-icon-help.customize-help-toggle").on("click",function(t){a("#accordion-section-wpglobus_fields_settings_section .customize-section-description").toggleClass("hidden")})},setUserControls:function(t,e){var o=e.controlSelector+" "+e.selector,n='<img class="'+WPGlobusCustomizeOptions.userControlIconClass+'" data-section="'+e.section+'" style="position:absolute;right:0px;" src="'+WPGlobusCustomizeOptions.userControlIcon+'" />';a(n).insertBefore(o),e.userControl.enabled||(1<a(o).length?a(o).each(function(t,e){a(e).removeClass(WPGlobusCustomize.controlClass)}):a(o).removeClass(WPGlobusCustomize.controlClass).val(e.setting))},ctrlMenuItemsCallback:function(t,e){},ctrlWidgetCallback:function(l,i){if(c.action=!1,void 0===c.controlWidgets[l].element){void 0===i&&(i=wp.customize.control.instance(l)),c.controlWidgets[l].element={},c.controlWidgets[l].control=i,c.controlWidgets[l].inWidgetTitle=i.container.find(".in-widget-title");var t=i.container.find("input[type=submit]");0!=t.length&&(t.css({display:"block"}),t.attr("data-widget",l),c.controlWidgets[l].submit=t,c.attachWidgetListeners(c.controlWidgets[l])),i.liveUpdateMode=!1,void 0===i.setting().title?c.controlWidgets[l].inWidgetTitle.text(""):c.controlWidgets[l].inWidgetTitle.text(": "+WPGlobusCore.TextFilter(i.setting().title,WPGlobusCustomize.languageAdmin)),a.each(WPGlobusCustomize.elementSelector,function(t,n){var s=i.container.find(n);0!=s.length&&a.each(s,function(t,e){if(void 0===e.id||""==e.id)return!0;var o=a(s[t]);void 0===c.controlWidgets[l].element[e.id]&&(c.controlWidgets[l].element[e.id]={}),o.addClass("wpglobus-customize-widget-control"),o.attr("data-widget",l),c.controlWidgets[l].element[e.id].element=o,c.controlWidgets[l].element[e.id].setting=i.setting(),c.controlWidgets[l].element[e.id].selector=n,c.controlWidgets[l].element[e.id].value=e.defaultValue,o.val(WPGlobusCore.TextFilter(e.defaultValue,WPGlobusCoreData.language,"RETURN_EMPTY"))})}),a(document).triggerHandler("wpglobus_customize_control_added_widget",[l])}},ctrlCallback:function(o,n,t){var s=!1;if(a.each(WPGlobusCustomize.disabledSections,function(t,e){if(o.section()==e)return s=!0,!1}),!s&&(a.each(WPGlobusCustomize.disabledSettingMask,function(t,e){if(0<=n.indexOf(e))return s=!0,!1}),!s)){var l=wp.customize.control.instance(n);if(0<=n.indexOf("widget"))return void 0===c.controlWidgets[n]&&(c.controlWidgets[n]={},c.action&&c.ctrlWidgetCallback(n,l)),c.controlWidgets[n].parent=l.selector,!1;if(void 0===c.controlInstances[n]){var i=!0;a.each(WPGlobusCustomize.elementSelector,function(t,e){var o=l.container.find(e);0!=o.length&&(c.controlInstances[n]={},c.controlInstances[n].element=o,c.controlInstances[n].setting=l.setting(),c.controlInstances[n].selector=e,c.controlInstances[n].controlSelector=l.selector,c.controlInstances[n].type="",c.controlInstances[n].section=l.section(),c.controlInstances[n].title=null,c.controlInstances[n].userControl=null,a.each(WPGlobusCustomize.setLinkBy,function(t,e){0<=n.indexOf(e)&&(c.controlInstances[n].type="link",""==c.controlInstances[n].setting&&(c.controlInstances[n].setting=o[0].defaultValue),o.addClass("wpglobus-control-link"))}),""===c.controlInstances[n].type&&(c.controlInstances[n].type="textarea"==e?"textarea":"text"),o.val(WPGlobusCore.TextFilter(c.controlInstances[n].setting,WPGlobusCoreData.language,"RETURN_EMPTY")),o.addClass("wpglobus-customize-control"),o.attr("data-wpglobus-customize-control",c.controlInstances[n].controlSelector.replace("#customize-control-","")),"link"==c.controlInstances[n].type&&(c.controlInstances[n].setting=c.convertString(o[0].defaultValue)),c.controlInstances[n].title=a(l.selector+" .customize-control-title").text(),null!==WPGlobusCustomizeOptions.userControl&&void 0!==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName]&&void 0!==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName][n]&&"disable"==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName][n]&&(i=!1),c.controlInstances[n].userControl={},c.controlInstances[n].userControl.enabled=i,c.setUserControls(n,c.controlInstances[n]))})}}},setControlInstances:function(){wp.customize.control.each(c.ctrlCallback)},setTitle:function(){a(WPGlobusCoreData.customize.info.element).html(WPGlobusCoreData.customize.info.html)},convertString:function(t){if(void 0===t)return t;var o=[],e=WPGlobusCore.getTranslations(t),n=0,s=!0;return a.each(e,function(t,e){""==e?o[n]="null":(s=!1,o[n]=e),n++}),s?"":o.join("|||")},getTranslations:function(t){var o={},n=t.split("|||");return a.each(WPGlobusCoreData.enabled_languages,function(t,e){o[e]="undefined"===n[t]||"null"===n[t]?"":n[t]}),o},getString:function(t,o,n){if(void 0===t)return t;void 0===o&&(o=""),void 0===n&&(n=WPGlobusCoreData.language);var e=c.getTranslations(t),s=[],l=0;return a.each(e,function(t,e){s[l]=t==n?o:""==e?"null":e,l++}),s=s.join("|||")},addLanguageSelector:function(){a(WPGlobusCustomize.selectorButton).insertAfter(".customize-controls-preview-toggle"),a(".wpglobus-customize-selector").html(c.selectorHtml.replace("{{language}}",WPGlobusCoreData.language)),a(document).on("click",".wpglobus-customize-selector",function(t){c.index>c.length-1?c.index=0:c.index++,WPGlobusCoreData.language=c.languages[c.index],a(this).html(c.selectorHtml.replace("{{language}}",WPGlobusCoreData.language)),a(document).triggerHandler("wpglobus_customize_control_language",[WPGlobusCoreData.language]),a(".wpglobus-customize-control").each(function(t,e){var o=a(e),n=o.data("customize-setting-link");if(void 0!==WPGlobusCustomize.controlInstances[n]||(n=o.data("wpglobus-customize-control"),void 0!==WPGlobusCustomize.controlInstances[n]))if(o.hasClass("wpglobus-control-link")){var s=c.getTranslations(WPGlobusCustomize.controlInstances[n].setting);o.val(s[WPGlobusCoreData.language])}else o.val(WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[n].setting,WPGlobusCoreData.language,"RETURN_EMPTY"))}),a(".wpglobus-customize-widget-control").each(function(t,e){var o=a(e),n=o.data("widget");if(void 0===o.attr("id"))return!0;o.val(WPGlobusCore.TextFilter(WPGlobusCustomize.controlWidgets[n].element[o.attr("id")].value,WPGlobusCoreData.language,"RETURN_EMPTY"))})})},updateElements:function(s){void 0===s&&(s=!0),a.each(WPGlobusCustomize.controlInstances,function(t,e){if(!e.userControl.enabled)return!0;var o=wp.customize.control.instance(t);if("link"==e.type){var n=c.getTranslations(WPGlobusCustomize.controlInstances[t].setting);s?(o.setting.set(n[WPGlobusCoreData.language]),e.element.val(o.setting())):e.element.val(n[WPGlobusCoreData.language])}else s?(o.setting.set(WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[t].setting,WPGlobusCoreData.language,"RETURN_EMPTY")),e.element.val(o.setting())):e.element.val(WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[t].setting,WPGlobusCoreData.language,"RETURN_EMPTY"))})},onSubmitEvents:function(t){"mouseenter"==t.type?a.each(c.controlWidgets[a(this).data("widget")].element,function(t,e){a("#"+t).val(e.value)}):"mouseleave"==t.type?c.widgetKeep||a.each(c.controlWidgets[a(this).data("widget")].element,function(t,e){a("#"+t).val(WPGlobusCore.TextFilter(e.value,WPGlobusCoreData.language,"RETURN_EMPTY"))}):"click"==t.type&&(c.widgetKeep=!0)},attachWidgetListeners:function(t){void 0!==t.submit[0].id&&a(document).on("mouseenter","#"+t.submit[0].id,c.onSubmitEvents).on("mouseleave","#"+t.submit[0].id,c.onSubmitEvents).on("click","#"+t.submit[0].id,c.onSubmitEvents)},attachListeners:function(){a(".wpglobus-customize-control").on("keyup",function(t){var e=a(this),o=e.data("customize-setting-link");void 0===WPGlobusCustomize.controlInstances[o]&&(o=e.data("wpglobus-customize-control"),void 0===WPGlobusCustomize.controlInstances[o])||("link"==WPGlobusCustomize.controlInstances[o].type?WPGlobusCustomize.controlInstances[o].setting=c.getString(WPGlobusCustomize.controlInstances[o].setting,e.val(),WPGlobusCoreData.language):WPGlobusCustomize.controlInstances[o].setting=WPGlobusCore.getString(WPGlobusCustomize.controlInstances[o].setting,e.val(),WPGlobusCoreData.language))}),a(document).on("keyup",".wpglobus-customize-widget-control",function(t){var e=a(this),o=e.data("widget");void 0!==WPGlobusCustomize.controlWidgets[o]&&(WPGlobusCustomize.controlWidgets[o].element[e.attr("id")].value=WPGlobusCore.getString(WPGlobusCustomize.controlWidgets[o].element[e.attr("id")].value,e.val(),WPGlobusCoreData.language))}),a("#save").on("mouseenter",function(t){a.each(WPGlobusCustomize.controlInstances,function(t,e){if(e.userControl.enabled){var o=wp.customize.control.instance(t);o.setting.set(e.setting),e.element.val(o.setting())}})}).on("mouseleave",function(t){c.instancesKeep||c.updateElements()}).on("click",function(t){c.instancesKeep=!0}),a(document).on("ajaxComplete",function(t,n){void 0!==n.responseText&&('{"success":true,"data":[]}'==n.responseText?c.updateElements(!1):(0<=n.responseText.indexOf("WP_CUSTOMIZER_SIGNATURE")&&(c.action="customizerAjaxComplete",c.setControlInstances()),a.each(WPGlobusCustomize.controlWidgets,function(t,e){var o=t.replace("_","-");if(0<=n.responseText.indexOf(o))return e.submit.css({display:"block"}),e.control.liveUpdateMode=!1,a.each(e.element,function(t,e){a("#"+t).val(WPGlobusCore.TextFilter(e.value,WPGlobusCoreData.language,"RETURN_EMPTY"))}),e.inWidgetTitle.text(": "+WPGlobusCore.TextFilter(e.control.setting().title,WPGlobusCustomize.languageAdmin)),c.widgetKeep=!1})))}),a(document).on("click",".widget-title, .widget-title-action",function(t){var o=a(this).parents(".customize-control-widget_form").attr("id");a.each(c.controlWidgets,function(t,e){if("#"+o==e.parent)return c.ctrlWidgetCallback(t),!1})})}};WPGlobusCustomize=a.extend({},WPGlobusCustomize,c),WPGlobusCustomize.init()});
includes/js/wpglobus-customize-control170.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(t){"use strict";var e={languages:{},index:0,length:0,controlInstances:{},controlWidgets:{},instancesKeep:!1,widgetKeep:!1,action:!1,customizeSave:!1,selectorHtml:'<span style="margin-left:5px;" class="wpglobus-icon-globe"></span><span style="font-weight:bold;">{{language}}</span>',settingsSectionExpand:function(){t(document).triggerHandler("wpglobus_fields_settings_section_expand",[this,e])},init:function(o){e.setTitle(),"false"!=WPGlobusCustomizeOptions.themeEnabled&&(t.each(WPGlobusCoreData.enabled_languages,function(t,o){e.languages[t]=o,e.length=t}),e.addLanguageSelector(),e.setControlInstances(),e.setFieldsSection(),e.attachListeners(),e.setTinymce())},updateTinymce:function(t){"tinymce"==WPGlobusCustomize.controlInstances[this.id].type&&(WPGlobusCustomize.controlInstances[this.id].setting=WPGlobusCore.getString(WPGlobusCustomize.controlInstances[this.id].setting,t.target.textContent,WPGlobusCoreData.language))},setTinymce:function(o){t(document).on("tinymce-editor-init",function(o,n){"object"==typeof e.controlInstances[n.id]&&(e.controlInstances[n.id].type="tinymce",t(n.iframeElement).addClass("wpglobus-customize-control").css({width:"99%"}),n.on("input",_.debounce(e.updateTinymce,300)))})},getSize:function(t){return void 0===t?_.size(e.controlInstances):"widget"==t?_.size(e.controlWidgets):null},setFieldsSection:function(){var o={},n=t(".wpglobus-fields_settings_control_box").data("section-template"),s="",i="",l="";t.each(WPGlobusCustomize.controlInstances,function(t,e){void 0===o[e.section]&&(o[e.section]={}),o[e.section][t]=e}),t.each(o,function(e,o){if(i="<ul>",t.each(o,function(t,e){l=e.userControl.enabled?" checked ":"",i+='<li id="'+e.fieldSettings.itemID+'">',i+='<input id="'+e.fieldSettings.cbID+'" data-control="'+t+'" class="wpglobus-customize-cb-control" type="checkbox"'+l+' /> <span class="wpglobus-cb-control-title">'+e.title+"</span>",i+="</li>"}),i+="</ul>",void 0===wp.customize.section(e))return!0;s=(s=(s=(s=n.replace("{{section_title}}",wp.customize.section(e).params.title)).replace(/{{section}}/g,e)).replace("{{section_id}}",'"'+e+'"')).replace("{{items}}",i),t(s).insertBefore(t("#"+WPGlobusCustomizeOptions.userControlSaveButton))}),t("#accordion-section-wpglobus_fields_settings_section").css({"margin-top":"15px"}),t(WPGlobusCustomizeOptions.helpButton).insertAfter(t("#accordion-section-wpglobus_fields_settings_section .customize-action")),t("#accordion-section-wpglobus_fields_settings_section .customize-section-description").addClass("hidden"),t(document).on("click","."+WPGlobusCustomizeOptions.userControlIconClass,function(o){var n=t(this).data("section");t(WPGlobusCustomizeOptions.userControlBoxSelector).each(function(e,o){n==t(o).data("section")?t(this).css({display:"block"}):t(this).css({display:"none"})}),wp.customize.control("wpglobus_fields_settings_section").expand({completeCallback:e.settingsSectionExpand})}),t(".wpglobus-customize-icon-help.customize-help-toggle").on("click",function(e){t("#accordion-section-wpglobus_fields_settings_section .customize-section-description").toggleClass("hidden")})},setUserControls:function(e,o){var n=o.controlSelector+" "+o.selector,s='<img class="'+WPGlobusCustomizeOptions.userControlIconClass+'" data-section="'+o.section+'" style="position:absolute;right:0px;cursor:pointer;" src="'+WPGlobusCustomizeOptions.userControlIcon+'" />';t(s).insertBefore(n),o.userControl.enabled||(t(n).length>1?t(n).each(function(e,o){t(o).removeClass(WPGlobusCustomize.controlClass)}):t(n).removeClass(WPGlobusCustomize.controlClass).val(o.setting))},ctrlMenuItemsCallback:function(t,e){},ctrlWidgetCallback:function(o,n){if(e.action=!1,void 0===e.controlWidgets[o].element){void 0===n&&(n=wp.customize.control.instance(o)),e.controlWidgets[o].element={},e.controlWidgets[o].control=n,e.controlWidgets[o].inWidgetTitle=n.container.find(".in-widget-title"),e.controlWidgets[o].parent=n.selector;var s=n.container.find("input[type=submit]");0!=s.length&&(s.css({display:"block"}),s.attr("data-widget",o),e.controlWidgets[o].submit=s,e.attachWidgetListeners(e.controlWidgets[o])),n.liveUpdateMode=!1,void 0===n.setting().title?e.controlWidgets[o].inWidgetTitle.text(""):e.controlWidgets[o].inWidgetTitle.text(": "+WPGlobusCore.TextFilter(n.setting().title,WPGlobusCustomize.languageAdmin)),t.each(WPGlobusCustomize.elementSelector,function(s,i){var l=n.container.find(i);0!=l.length&&t.each(l,function(s,a){if(void 0===a.id||""==a.id)return!0;var c=t(l[s]);void 0===e.controlWidgets[o].element[a.id]&&(e.controlWidgets[o].element[a.id]={}),c.addClass("wpglobus-customize-widget-control"),c.attr("data-widget",o),e.controlWidgets[o].element[a.id].element=c,e.controlWidgets[o].element[a.id].setting=n.setting(),e.controlWidgets[o].element[a.id].selector=i,e.controlWidgets[o].element[a.id].value=a.defaultValue,c.val(WPGlobusCore.TextFilter(a.defaultValue,WPGlobusCoreData.language,"RETURN_EMPTY"))})}),t(document).triggerHandler("wpglobus_customize_control_added_widget",[o])}},ctrlCallback:function(o,n,s){var i=!1;if(t.each(WPGlobusCustomize.disabledSections,function(t,e){if(o.section()==e)return i=!0,!1}),!i&&(t.each(WPGlobusCustomize.disabledSettingMask,function(t,e){if(n.indexOf(e)>=0)return i=!0,!1}),!i)){var l=wp.customize.control.instance(n);if(n.indexOf("widget")>=0)return void 0===e.controlWidgets[n]&&(e.controlWidgets[n]={},e.action&&e.ctrlWidgetCallback(n,l)),e.controlWidgets[n].parent=l.selector,1!=t(l.selector).length?e.controlWidgets[n].observer=null:(e.controlWidgets[n].observer=new MutationObserver(function(t){t.forEach(function(t){"class"==t.attributeName&&-1!=t.target.className.indexOf("expanding")&&e.ctrlWidgetCallback(n)})}),e.controlWidgets[n].observer.observe(document.querySelector(e.controlWidgets[n].parent),{attributes:!0,childList:!0,characterData:!0})),!1;if(void 0===e.controlInstances[n]){var a=!0;t.each(WPGlobusCustomize.elementSelector,function(o,s){var i=l.container.find(s);0!=i.length&&(e.controlInstances[n]={},e.controlInstances[n].element=i,e.controlInstances[n].elementID=i.attr("id")?"#"+i.attr("id"):void 0,e.controlInstances[n].setting=l.setting(),e.controlInstances[n].selector=s,e.controlInstances[n].controlSelector=l.selector,e.controlInstances[n].type="",e.controlInstances[n].section=l.section(),e.controlInstances[n].title=null,e.controlInstances[n].userControl=null,e.controlInstances[n].fieldSettings={},e.controlInstances[n].fieldSettings.itemID="item-wpglobus-cb-control-"+WPGlobusDialogApp.convertToId(n),e.controlInstances[n].fieldSettings.cbID="wpglobus-cb-control-"+WPGlobusDialogApp.convertToId(n),t.each(WPGlobusCustomize.setLinkBy,function(o,s){if(n.indexOf(s)>=0){if(e.controlInstances[n].type="link",""==e.controlInstances[n].setting&&(e.controlInstances[n].setting=i[0].defaultValue),WPGlobusCustomize.changeset_uuid){var l=wp.customize.control(n).setting();if(-1!==l.indexOf("|||")){var a=e.getTranslations(l);wp.customize.control(n).setting(a[WPGlobusCoreData.default_language]),t(WPGlobusCustomize.controlInstances[n].controlSelector+" "+WPGlobusCustomize.controlInstances[n].selector).val(a[WPGlobusCoreData.default_language])}}i.addClass("wpglobus-control-link")}}),""===e.controlInstances[n].type&&(e.controlInstances[n].type="textarea"==s?"textarea":"text"),i.val(WPGlobusCore.TextFilter(e.controlInstances[n].setting,WPGlobusCoreData.language,"RETURN_EMPTY")),i.addClass("wpglobus-customize-control"),i.attr("data-wpglobus-customize-control",e.controlInstances[n].controlSelector.replace("#customize-control-","")),"link"==e.controlInstances[n].type&&(e.controlInstances[n].setting=e.convertString(i[0].defaultValue)),e.controlInstances[n].title=l.params.label,null!==WPGlobusCustomizeOptions.userControl&&void 0!==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName]&&void 0!==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName][n]&&"disable"==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName][n]&&(a=!1),e.controlInstances[n].userControl={},e.controlInstances[n].userControl.enabled=a,e.setUserControls(n,e.controlInstances[n]))})}}},setControlInstances:function(){wp.customize.control.each(e.ctrlCallback)},setTitle:function(){t(WPGlobusCoreData.customize.info.element).html(WPGlobusCoreData.customize.info.html)},convertString:function(e){if(void 0===e)return e;var o=[],n=WPGlobusCore.getTranslations(e),s=0,i=!0;return e==n[WPGlobusCoreData.default_language]?e:(t.each(n,function(t,e){""==e?o[s]="null":(i=!1,o[s]=e),s++}),i?"":o.join("|||"))},getTranslations:function(e){if(void 0===e)return e;var o={},n=e.split("|||");return t.each(WPGlobusCoreData.enabled_languages,function(t,e){o[e]=void 0===n[t]||"null"===n[t]?"":n[t]}),o},getString:function(o,n,s){if(void 0===o)return o;void 0===n&&(n=""),void 0===s&&(s=WPGlobusCoreData.language);var i=e.getTranslations(o),l=[],a=0,c=!0;return t.each(i,function(t,e){t==s?(n=n.trim(),l[a]=""==n?"null":n):l[a]=""==e?"null":e,t!=WPGlobusCoreData.default_language&&"null"!=l[a]&&(c=!1),a++}),l=c?l[0]:l.join("|||")},addLanguageSelector:function(){t(WPGlobusCustomize.selectorButton).insertAfter(".customize-controls-preview-toggle"),t(".wpglobus-customize-selector").html(e.selectorHtml.replace("{{language}}",WPGlobusCoreData.language)),t(document).on("click",".wpglobus-customize-selector",function(o){e.index>e.length-1?e.index=0:e.index++,WPGlobusCoreData.language=e.languages[e.index],t(this).html(e.selectorHtml.replace("{{language}}",WPGlobusCoreData.language)),t(document).triggerHandler("wpglobus_customize_control_language",[WPGlobusCoreData.language]),t(".wpglobus-customize-control").each(function(o,n){var s=t(n),i=s.data("customize-setting-link");if(void 0!==WPGlobusCustomize.controlInstances[i]||(i=s.data("wpglobus-customize-control"),void 0!==WPGlobusCustomize.controlInstances[i]))if(s.hasClass("wpglobus-control-link")){var l=e.getTranslations(WPGlobusCustomize.controlInstances[i].setting);s.val(l[WPGlobusCoreData.language])}else{l=WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[i].setting,WPGlobusCoreData.language,"RETURN_EMPTY");"tinymce"==WPGlobusCustomize.controlInstances[i].type&&tinymce.get(i).setContent(l,{format:"raw"}),s.val(WPGlobusCore.TextFilter(l,"RETURN_EMPTY"))}}),t(".wpglobus-customize-widget-control").each(function(e,o){var n=t(o),s=n.data("widget");if(void 0===n.attr("id"))return!0;n.val(WPGlobusCore.TextFilter(WPGlobusCustomize.controlWidgets[s].element[n.attr("id")].value,WPGlobusCoreData.language,"RETURN_EMPTY"))})})},updateElements:function(o){void 0===o&&(o=!0),t.each(WPGlobusCustomize.controlInstances,function(t,n){if(!n.userControl.enabled)return!0;var s=wp.customize.control.instance(t);if("link"==n.type){var i=e.getTranslations(WPGlobusCustomize.controlInstances[t].setting);o?(s.setting.set(i[WPGlobusCoreData.language]),n.element.val(s.setting())):n.element.val(i[WPGlobusCoreData.language])}else if("tinymce"==n.type){i=WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[t].setting,WPGlobusCoreData.language,"RETURN_EMPTY");tinymce.get(t).setContent(i,{format:"raw"}),n.element.val(i)}else o?(s.setting.set(WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[t].setting,WPGlobusCoreData.language,"RETURN_EMPTY")),n.element.val(s.setting())):n.element.val(WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[t].setting,WPGlobusCoreData.language,"RETURN_EMPTY"))})},onSubmitEvents:function(o){"mouseenter"==o.type?t.each(e.controlWidgets[t(this).data("widget")].element,function(e,o){t("#"+e).val(o.value)}):"mouseleave"==o.type?e.widgetKeep||t.each(e.controlWidgets[t(this).data("widget")].element,function(e,o){t("#"+e).val(WPGlobusCore.TextFilter(o.value,WPGlobusCoreData.language,"RETURN_EMPTY"))}):"click"==o.type&&(e.widgetKeep=!0)},attachWidgetListeners:function(o){void 0!==o.submit[0].id&&t(document).on("mouseenter","#"+o.submit[0].id,e.onSubmitEvents).on("mouseleave","#"+o.submit[0].id,e.onSubmitEvents).on("click","#"+o.submit[0].id,e.onSubmitEvents)},attachListeners:function(){t(".wpglobus-customize-control").on("keyup",function(o){var n=t(this),s=n.data("customize-setting-link");void 0===WPGlobusCustomize.controlInstances[s]&&(s=n.data("wpglobus-customize-control"),WPGlobusCustomize.controlInstances[s]),void 0===t(document).triggerHandler("wpglobus_customize_control_keyup",[n,s])&&("link"==WPGlobusCustomize.controlInstances[s].type?WPGlobusCustomize.controlInstances[s].setting=e.getString(WPGlobusCustomize.controlInstances[s].setting,n.val(),WPGlobusCoreData.language):WPGlobusCustomize.controlInstances[s].setting=WPGlobusCore.getString(WPGlobusCustomize.controlInstances[s].setting,n.val(),WPGlobusCoreData.language))}),t(document).on("keyup",".wpglobus-customize-widget-control",function(e){var o=t(this),n=o.data("widget");void 0!==WPGlobusCustomize.controlWidgets[n]&&(WPGlobusCustomize.controlWidgets[n].element[o.attr("id")].value=WPGlobusCore.getString(WPGlobusCustomize.controlWidgets[n].element[o.attr("id")].value,o.val(),WPGlobusCoreData.language))}),t(document).on("mouseenter","#save",function(e){t.each(WPGlobusCustomize.controlInstances,function(t,e){if(e.userControl.enabled){var o=wp.customize.control.instance(t);"tinymce"==e.type&&tinymce.get(t).setContent(e.setting,{format:"raw"}),o.setting.set(e.setting),e.element.val(o.setting())}})}).on("mouseleave","#save",function(t){e.instancesKeep||(e.updateElements(),wp.customize.previewer.refresh())}),t("#save").on("click",function(t){e.instancesKeep=!0}),t(document).on("ajaxSend",function(t,o,n){void 0!==n.data&&-1!=n.data.indexOf("wp_customize=on")&&-1!=n.data.indexOf("action=customize_save")&&(e.customizeSave=!0)}),t(document).on("ajaxComplete",function(o,n){void 0!==n.responseText&&(e.customizeSave?(e.updateElements(!1),e.instancesKeep&&(e.instancesKeep=!1)):(n.responseText.indexOf("WP_CUSTOMIZER_SIGNATURE")>=0&&(e.action="customizerAjaxComplete",e.setControlInstances()),t.each(WPGlobusCustomize.controlWidgets,function(o,s){var i=o.replace("_","-");if(n.responseText.indexOf(i)>=0)return s.submit.css({display:"block"}),s.control.liveUpdateMode=!1,t.each(s.element,function(e,o){t("#"+e).val(WPGlobusCore.TextFilter(o.value,WPGlobusCoreData.language,"RETURN_EMPTY"))}),s.inWidgetTitle.text(": "+WPGlobusCore.TextFilter(s.control.setting().title,WPGlobusCustomize.languageAdmin)),e.widgetKeep=!1,!1})),e.customizeSave=!1,wp.customize.previewer.refresh())})}};WPGlobusCustomize=t.extend({},WPGlobusCustomize,e),WPGlobusCustomize.init()});
1
+ jQuery(document).ready(function(c){"use strict";var u={languages:{},index:0,length:0,controlInstances:{},controlWidgets:{},instancesKeep:!1,widgetKeep:!1,action:!1,customizeSave:!1,selectorHtml:'<span style="margin-left:5px;" class="wpglobus-icon-globe"></span><span style="font-weight:bold;">{{language}}</span>',settingsSectionExpand:function(){c(document).triggerHandler("wpglobus_fields_settings_section_expand",[this,u])},init:function(t){u.setTitle(),"false"!=WPGlobusCustomizeOptions.themeEnabled&&(c.each(WPGlobusCoreData.enabled_languages,function(t,e){u.languages[t]=e,u.length=t}),u.addLanguageSelector(),u.setControlInstances(),u.setFieldsSection(),u.attachListeners(),u.setTinymce())},updateTinymce:function(t){"tinymce"==WPGlobusCustomize.controlInstances[this.id].type&&(WPGlobusCustomize.controlInstances[this.id].setting=WPGlobusCore.getString(WPGlobusCustomize.controlInstances[this.id].setting,t.target.textContent,WPGlobusCoreData.language))},setTinymce:function(t){c(document).on("tinymce-editor-init",function(t,e){"object"==typeof u.controlInstances[e.id]&&(u.controlInstances[e.id].type="tinymce",c(e.iframeElement).addClass("wpglobus-customize-control").css({width:"99%"}),e.on("input",_.debounce(u.updateTinymce,300)))})},getSize:function(t){return void 0===t?_.size(u.controlInstances):"widget"==t?_.size(u.controlWidgets):null},setFieldsSection:function(){var o={},n=c(".wpglobus-fields_settings_control_box").data("section-template"),s="",i="",l="";c.each(WPGlobusCustomize.controlInstances,function(t,e){void 0===o[e.section]&&(o[e.section]={}),o[e.section][t]=e}),c.each(o,function(t,e){if(i="<ul>",c.each(e,function(t,e){l=e.userControl.enabled?" checked ":"",i+='<li id="'+e.fieldSettings.itemID+'">',i+='<input id="'+e.fieldSettings.cbID+'" data-control="'+t+'" class="wpglobus-customize-cb-control" type="checkbox"'+l+' /> <span class="wpglobus-cb-control-title">'+e.title+"</span>",i+="</li>"}),i+="</ul>",void 0===wp.customize.section(t))return!0;s=(s=(s=(s=n.replace("{{section_title}}",wp.customize.section(t).params.title)).replace(/{{section}}/g,t)).replace("{{section_id}}",'"'+t+'"')).replace("{{items}}",i),c(s).insertBefore(c("#"+WPGlobusCustomizeOptions.userControlSaveButton))}),c("#accordion-section-wpglobus_fields_settings_section").css({"margin-top":"15px"}),c(WPGlobusCustomizeOptions.helpButton).insertAfter(c("#accordion-section-wpglobus_fields_settings_section .customize-action")),c("#accordion-section-wpglobus_fields_settings_section .customize-section-description").addClass("hidden"),c(document).on("click","."+WPGlobusCustomizeOptions.userControlIconClass,function(t){var o=c(this).data("section");c(WPGlobusCustomizeOptions.userControlBoxSelector).each(function(t,e){o==c(e).data("section")?c(this).css({display:"block"}):c(this).css({display:"none"})}),wp.customize.control("wpglobus_fields_settings_section").expand({completeCallback:u.settingsSectionExpand})}),c(".wpglobus-customize-icon-help.customize-help-toggle").on("click",function(t){c("#accordion-section-wpglobus_fields_settings_section .customize-section-description").toggleClass("hidden")})},setUserControls:function(t,e){var o=e.controlSelector+" "+e.selector,n='<img class="'+WPGlobusCustomizeOptions.userControlIconClass+'" data-section="'+e.section+'" style="position:absolute;right:0px;cursor:pointer;" src="'+WPGlobusCustomizeOptions.userControlIcon+'" />';c(n).insertBefore(o),e.userControl.enabled||(1<c(o).length?c(o).each(function(t,e){c(e).removeClass(WPGlobusCustomize.controlClass)}):c(o).removeClass(WPGlobusCustomize.controlClass).val(e.setting))},ctrlMenuItemsCallback:function(t,e){},ctrlWidgetCallback:function(i,l){if(u.action=!1,void 0===u.controlWidgets[i].element){void 0===l&&(l=wp.customize.control.instance(i)),u.controlWidgets[i].element={},u.controlWidgets[i].control=l,u.controlWidgets[i].inWidgetTitle=l.container.find(".in-widget-title"),u.controlWidgets[i].parent=l.selector;var t=l.container.find("input[type=submit]");0!=t.length&&(t.css({display:"block"}),t.attr("data-widget",i),u.controlWidgets[i].submit=t,u.attachWidgetListeners(u.controlWidgets[i])),l.liveUpdateMode=!1,void 0===l.setting().title?u.controlWidgets[i].inWidgetTitle.text(""):u.controlWidgets[i].inWidgetTitle.text(": "+WPGlobusCore.TextFilter(l.setting().title,WPGlobusCustomize.languageAdmin)),c.each(WPGlobusCustomize.elementSelector,function(t,n){var s=l.container.find(n);0!=s.length&&c.each(s,function(t,e){if(void 0===e.id||""==e.id)return!0;var o=c(s[t]);void 0===u.controlWidgets[i].element[e.id]&&(u.controlWidgets[i].element[e.id]={}),o.addClass("wpglobus-customize-widget-control"),o.attr("data-widget",i),u.controlWidgets[i].element[e.id].element=o,u.controlWidgets[i].element[e.id].setting=l.setting(),u.controlWidgets[i].element[e.id].selector=n,u.controlWidgets[i].element[e.id].value=e.defaultValue,o.val(WPGlobusCore.TextFilter(e.defaultValue,WPGlobusCoreData.language,"RETURN_EMPTY"))})}),c(document).triggerHandler("wpglobus_customize_control_added_widget",[i])}},ctrlCallback:function(o,i,t){var n=!1;if(c.each(WPGlobusCustomize.disabledSections,function(t,e){if(o.section()==e)return n=!0,!1}),!n&&(c.each(WPGlobusCustomize.disabledSettingMask,function(t,e){if(0<=i.indexOf(e))return n=!0,!1}),!n)){var l=wp.customize.control.instance(i);if(0<=i.indexOf("widget"))return void 0===u.controlWidgets[i]&&(u.controlWidgets[i]={},u.action&&u.ctrlWidgetCallback(i,l)),u.controlWidgets[i].parent=l.selector,1!=c(l.selector).length?u.controlWidgets[i].observer=null:(u.controlWidgets[i].observer=new MutationObserver(function(t){t.forEach(function(t){"class"==t.attributeName&&-1!=t.target.className.indexOf("expanding")&&u.ctrlWidgetCallback(i)})}),u.controlWidgets[i].observer.observe(document.querySelector(u.controlWidgets[i].parent),{attributes:!0,childList:!0,characterData:!0})),!1;if(void 0===u.controlInstances[i]){var a=!0;c.each(WPGlobusCustomize.elementSelector,function(t,e){var s=l.container.find(e);0!=s.length&&(u.controlInstances[i]={},u.controlInstances[i].element=s,u.controlInstances[i].elementID=s.attr("id")?"#"+s.attr("id"):void 0,u.controlInstances[i].setting=l.setting(),u.controlInstances[i].selector=e,u.controlInstances[i].controlSelector=l.selector,u.controlInstances[i].type="",u.controlInstances[i].section=l.section(),u.controlInstances[i].title=null,u.controlInstances[i].userControl=null,u.controlInstances[i].fieldSettings={},u.controlInstances[i].fieldSettings.itemID="item-wpglobus-cb-control-"+WPGlobusDialogApp.convertToId(i),u.controlInstances[i].fieldSettings.cbID="wpglobus-cb-control-"+WPGlobusDialogApp.convertToId(i),c.each(WPGlobusCustomize.setLinkBy,function(t,e){if(0<=i.indexOf(e)){if(u.controlInstances[i].type="link",""==u.controlInstances[i].setting&&(u.controlInstances[i].setting=s[0].defaultValue),WPGlobusCustomize.changeset_uuid){var o=wp.customize.control(i).setting();if(-1!==o.indexOf("|||")){var n=u.getTranslations(o);wp.customize.control(i).setting(n[WPGlobusCoreData.default_language]),c(WPGlobusCustomize.controlInstances[i].controlSelector+" "+WPGlobusCustomize.controlInstances[i].selector).val(n[WPGlobusCoreData.default_language])}}s.addClass("wpglobus-control-link")}}),""===u.controlInstances[i].type&&(u.controlInstances[i].type="textarea"==e?"textarea":"text"),s.val(WPGlobusCore.TextFilter(u.controlInstances[i].setting,WPGlobusCoreData.language,"RETURN_EMPTY")),s.addClass("wpglobus-customize-control"),s.attr("data-wpglobus-customize-control",u.controlInstances[i].controlSelector.replace("#customize-control-","")),"link"==u.controlInstances[i].type&&(u.controlInstances[i].setting=u.convertString(s[0].defaultValue)),u.controlInstances[i].title=l.params.label,null!==WPGlobusCustomizeOptions.userControl&&void 0!==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName]&&void 0!==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName][i]&&"disable"==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName][i]&&(a=!1),u.controlInstances[i].userControl={},u.controlInstances[i].userControl.enabled=a,u.setUserControls(i,u.controlInstances[i]))})}}},setControlInstances:function(){wp.customize.control.each(u.ctrlCallback)},setTitle:function(){c(WPGlobusCoreData.customize.info.element).html(WPGlobusCoreData.customize.info.html)},convertString:function(t){if(void 0===t)return t;var o=[],e=WPGlobusCore.getTranslations(t),n=0,s=!0;return t==e[WPGlobusCoreData.default_language]?t:(c.each(e,function(t,e){""==e?o[n]="null":(s=!1,o[n]=e),n++}),s?"":o.join("|||"))},getTranslations:function(t){if(void 0===t)return t;var o={},n=t.split("|||");return c.each(WPGlobusCoreData.enabled_languages,function(t,e){o[e]=void 0===n[t]||"null"===n[t]?"":n[t]}),o},getString:function(t,o,n){if(void 0===t)return t;void 0===o&&(o=""),void 0===n&&(n=WPGlobusCoreData.language);var e=u.getTranslations(t),s=[],i=0,l=!0;return c.each(e,function(t,e){t==n?(o=o.trim(),s[i]=""==o?"null":o):s[i]=""==e?"null":e,t!=WPGlobusCoreData.default_language&&"null"!=s[i]&&(l=!1),i++}),s=l?s[0]:s.join("|||")},addLanguageSelector:function(){c(WPGlobusCustomize.selectorButton).insertAfter(".customize-controls-preview-toggle"),c(".wpglobus-customize-selector").html(u.selectorHtml.replace("{{language}}",WPGlobusCoreData.language)),c(document).on("click",".wpglobus-customize-selector",function(t){u.index>u.length-1?u.index=0:u.index++,WPGlobusCoreData.language=u.languages[u.index],c(this).html(u.selectorHtml.replace("{{language}}",WPGlobusCoreData.language)),c(document).triggerHandler("wpglobus_customize_control_language",[WPGlobusCoreData.language]),c(".wpglobus-customize-control").each(function(t,e){var o=c(e),n=o.data("customize-setting-link");if(void 0!==WPGlobusCustomize.controlInstances[n]||(n=o.data("wpglobus-customize-control"),void 0!==WPGlobusCustomize.controlInstances[n]))if(o.hasClass("wpglobus-control-link")){var s=u.getTranslations(WPGlobusCustomize.controlInstances[n].setting);o.val(s[WPGlobusCoreData.language])}else{s=WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[n].setting,WPGlobusCoreData.language,"RETURN_EMPTY");"tinymce"==WPGlobusCustomize.controlInstances[n].type&&tinymce.get(n).setContent(s,{format:"raw"}),o.val(WPGlobusCore.TextFilter(s,"RETURN_EMPTY"))}}),c(".wpglobus-customize-widget-control").each(function(t,e){var o=c(e),n=o.data("widget");if(void 0===o.attr("id"))return!0;o.val(WPGlobusCore.TextFilter(WPGlobusCustomize.controlWidgets[n].element[o.attr("id")].value,WPGlobusCoreData.language,"RETURN_EMPTY"))})})},updateElements:function(s){void 0===s&&(s=!0),c.each(WPGlobusCustomize.controlInstances,function(t,e){if(!e.userControl.enabled)return!0;var o=wp.customize.control.instance(t);if("link"==e.type){var n=u.getTranslations(WPGlobusCustomize.controlInstances[t].setting);s?(o.setting.set(n[WPGlobusCoreData.language]),e.element.val(o.setting())):e.element.val(n[WPGlobusCoreData.language])}else if("tinymce"==e.type){n=WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[t].setting,WPGlobusCoreData.language,"RETURN_EMPTY");tinymce.get(t).setContent(n,{format:"raw"}),e.element.val(n)}else s?(o.setting.set(WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[t].setting,WPGlobusCoreData.language,"RETURN_EMPTY")),e.element.val(o.setting())):e.element.val(WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[t].setting,WPGlobusCoreData.language,"RETURN_EMPTY"))})},onSubmitEvents:function(t){"mouseenter"==t.type?c.each(u.controlWidgets[c(this).data("widget")].element,function(t,e){c("#"+t).val(e.value)}):"mouseleave"==t.type?u.widgetKeep||c.each(u.controlWidgets[c(this).data("widget")].element,function(t,e){c("#"+t).val(WPGlobusCore.TextFilter(e.value,WPGlobusCoreData.language,"RETURN_EMPTY"))}):"click"==t.type&&(u.widgetKeep=!0)},attachWidgetListeners:function(t){void 0!==t.submit[0].id&&c(document).on("mouseenter","#"+t.submit[0].id,u.onSubmitEvents).on("mouseleave","#"+t.submit[0].id,u.onSubmitEvents).on("click","#"+t.submit[0].id,u.onSubmitEvents)},attachListeners:function(){c(".wpglobus-customize-control").on("keyup",function(t){var e=c(this),o=e.data("customize-setting-link");void 0===WPGlobusCustomize.controlInstances[o]&&(o=e.data("wpglobus-customize-control"),WPGlobusCustomize.controlInstances[o]),void 0===c(document).triggerHandler("wpglobus_customize_control_keyup",[e,o])&&("link"==WPGlobusCustomize.controlInstances[o].type?WPGlobusCustomize.controlInstances[o].setting=u.getString(WPGlobusCustomize.controlInstances[o].setting,e.val(),WPGlobusCoreData.language):WPGlobusCustomize.controlInstances[o].setting=WPGlobusCore.getString(WPGlobusCustomize.controlInstances[o].setting,e.val(),WPGlobusCoreData.language))}),c(document).on("keyup",".wpglobus-customize-widget-control",function(t){var e=c(this),o=e.data("widget");void 0!==WPGlobusCustomize.controlWidgets[o]&&(WPGlobusCustomize.controlWidgets[o].element[e.attr("id")].value=WPGlobusCore.getString(WPGlobusCustomize.controlWidgets[o].element[e.attr("id")].value,e.val(),WPGlobusCoreData.language))}),c(document).on("mouseenter","#save",function(t){c.each(WPGlobusCustomize.controlInstances,function(t,e){if(e.userControl.enabled){var o=wp.customize.control.instance(t);"tinymce"==e.type&&tinymce.get(t).setContent(e.setting,{format:"raw"}),o.setting.set(e.setting),e.element.val(o.setting())}})}).on("mouseleave","#save",function(t){u.instancesKeep||(u.updateElements(),wp.customize.previewer.refresh())}),c("#save").on("click",function(t){u.instancesKeep=!0}),c(document).on("ajaxSend",function(t,e,o){void 0!==o.data&&-1!=o.data.indexOf("wp_customize=on")&&-1!=o.data.indexOf("action=customize_save")&&(u.customizeSave=!0)}),c(document).on("ajaxComplete",function(t,n){void 0!==n.responseText&&(u.customizeSave?(u.updateElements(!1),u.instancesKeep&&(u.instancesKeep=!1)):(0<=n.responseText.indexOf("WP_CUSTOMIZER_SIGNATURE")&&(u.action="customizerAjaxComplete",u.setControlInstances()),c.each(WPGlobusCustomize.controlWidgets,function(t,e){var o=t.replace("_","-");if(0<=n.responseText.indexOf(o))return e.submit.css({display:"block"}),e.control.liveUpdateMode=!1,c.each(e.element,function(t,e){c("#"+t).val(WPGlobusCore.TextFilter(e.value,WPGlobusCoreData.language,"RETURN_EMPTY"))}),e.inWidgetTitle.text(": "+WPGlobusCore.TextFilter(e.control.setting().title,WPGlobusCustomize.languageAdmin)),u.widgetKeep=!1})),u.customizeSave=!1,wp.customize.previewer.refresh())})}};WPGlobusCustomize=c.extend({},WPGlobusCustomize,u),WPGlobusCustomize.init()});
includes/js/wpglobus-customize-control190.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){"use strict";var t={languages:{},index:0,length:0,controlInstances:{},controlWidgets:{},instancesKeep:!1,widgetKeep:!1,action:!1,customizeSave:!1,selectorHtml:'<span style="margin-left:5px;" class="wpglobus-icon-globe"></span><span class="current-language" style="font-weight:bold;">{{language}}</span>',settingsSectionExpand:function(){e(document).triggerHandler("wpglobus_fields_settings_section_expand",[this,t])},init:function(o){t.setTitle(),"false"!=WPGlobusCustomizeOptions.themeEnabled&&(e.each(WPGlobusCoreData.enabled_languages,function(e,o){t.languages[e]=o,t.length=e}),t.addLanguageSelector(),t.setControlInstances(),t.setFieldsSection(),t.attachListeners(),t.setTinymce())},updateTinymce:function(e){"tinymce"==WPGlobusCustomize.controlInstances[this.id].type&&(WPGlobusCustomize.controlInstances[this.id].setting=WPGlobusCore.getString(WPGlobusCustomize.controlInstances[this.id].setting,e.target.textContent,WPGlobusCoreData.language))},setTinymce:function(o){e(document).on("tinymce-editor-init",function(o,n){"object"==typeof t.controlInstances[n.id]&&(t.controlInstances[n.id].type="tinymce",e(n.iframeElement).addClass("wpglobus-customize-control").css({width:"99%"}),n.on("input",_.debounce(t.updateTinymce,300)))})},getSize:function(e){return void 0===e?_.size(t.controlInstances):"widget"==e?_.size(t.controlWidgets):null},setFieldsSection:function(){var o={},n=e(".wpglobus-fields_settings_control_box").data("section-template"),s="",l="",i="";e.each(WPGlobusCustomize.controlInstances,function(e,t){void 0===o[t.section]&&(o[t.section]={}),o[t.section][e]=t}),e.each(o,function(t,o){if(l="<ul>",e.each(o,function(e,t){i=t.userControl.enabled?" checked ":"",l+='<li id="'+t.fieldSettings.itemID+'">',l+='<input id="'+t.fieldSettings.cbID+'" data-control="'+e+'" class="wpglobus-customize-cb-control" type="checkbox"'+i+' /> <span class="wpglobus-cb-control-title">'+t.title+"</span>",l+="</li>"}),l+="</ul>",void 0===wp.customize.section(t))return!0;s=(s=(s=(s=n.replace("{{section_title}}",wp.customize.section(t).params.title)).replace(/{{section}}/g,t)).replace("{{section_id}}",'"'+t+'"')).replace("{{items}}",l),e(s).insertBefore(e("#"+WPGlobusCustomizeOptions.userControlSaveButton))}),e("#accordion-section-wpglobus_fields_settings_section").css({"margin-top":"15px"}),e(WPGlobusCustomizeOptions.helpButton).insertAfter(e("#accordion-section-wpglobus_fields_settings_section .customize-action")),e("#accordion-section-wpglobus_fields_settings_section .customize-section-description").addClass("hidden"),e(document).on("click","."+WPGlobusCustomizeOptions.userControlIconClass,function(o){var n=e(this).data("section");e(WPGlobusCustomizeOptions.userControlBoxSelector).each(function(t,o){n==e(o).data("section")?e(this).css({display:"block"}):e(this).css({display:"none"})}),wp.customize.control("wpglobus_fields_settings_section").expand({completeCallback:t.settingsSectionExpand})}),e(".wpglobus-customize-icon-help.customize-help-toggle").on("click",function(t){e("#accordion-section-wpglobus_fields_settings_section .customize-section-description").toggleClass("hidden")})},setUserControls:function(t,o){var n=o.controlSelector+" "+o.selector,s='<img class="'+WPGlobusCustomizeOptions.userControlIconClass+'" data-section="'+o.section+'" style="position:absolute;right:0px;cursor:pointer;" src="'+WPGlobusCustomizeOptions.userControlIcon+'" />';e(s).insertBefore(n),o.userControl.enabled||(e(n).length>1?e(n).each(function(t,o){e(o).removeClass(WPGlobusCustomize.controlClass)}):e(n).removeClass(WPGlobusCustomize.controlClass).val(o.setting))},ctrlMenuItemsCallback:function(e,t){},ctrlWidgetCallback:function(o,n){if(t.action=!1,void 0===t.controlWidgets[o].element){void 0===n&&(n=wp.customize.control.instance(o)),t.controlWidgets[o].element={},t.controlWidgets[o].control=n,t.controlWidgets[o].inWidgetTitle=n.container.find(".in-widget-title"),t.controlWidgets[o].parent=n.selector;var s=n.container.find("input[type=submit]");0!=s.length&&(s.css({display:"block"}),s.attr("data-widget",o),t.controlWidgets[o].submit=s,t.attachWidgetListeners(t.controlWidgets[o])),n.liveUpdateMode=!1,void 0===n.setting().title?t.controlWidgets[o].inWidgetTitle.text(""):t.controlWidgets[o].inWidgetTitle.text(": "+WPGlobusCore.TextFilter(n.setting().title,WPGlobusCustomize.languageAdmin)),e.each(WPGlobusCustomize.elementSelector,function(s,l){var i=n.container.find(l);0!=i.length&&e.each(i,function(s,a){if(void 0===a.id||""==a.id)return!0;var c=e(i[s]);void 0===t.controlWidgets[o].element[a.id]&&(t.controlWidgets[o].element[a.id]={}),c.addClass("wpglobus-customize-widget-control"),c.attr("data-widget",o),t.controlWidgets[o].element[a.id].element=c,t.controlWidgets[o].element[a.id].setting=n.setting(),t.controlWidgets[o].element[a.id].selector=l,t.controlWidgets[o].element[a.id].value=a.defaultValue,c.val(WPGlobusCore.TextFilter(a.defaultValue,WPGlobusCoreData.language,"RETURN_EMPTY"))})}),e(document).triggerHandler("wpglobus_customize_control_added_widget",[o])}},ctrlCallback:function(o,n,s){var l=!1;if(e.each(WPGlobusCustomize.disabledSections,function(e,t){if(o.section()==t)return l=!0,!1}),!l&&(e.each(WPGlobusCustomize.disabledSettingMask,function(e,t){if(n.indexOf(t)>=0)return l=!0,!1}),!l)){var i=wp.customize.control.instance(n);if(n.indexOf("widget")>=0)return void 0===t.controlWidgets[n]&&(t.controlWidgets[n]={},t.action&&t.ctrlWidgetCallback(n,i)),t.controlWidgets[n].parent=i.selector,1!=e(i.selector).length?t.controlWidgets[n].observer=null:(t.controlWidgets[n].observer=new MutationObserver(function(e){e.forEach(function(e){"class"==e.attributeName&&-1!=e.target.className.indexOf("expanding")&&t.ctrlWidgetCallback(n)})}),t.controlWidgets[n].observer.observe(document.querySelector(t.controlWidgets[n].parent),{attributes:!0,childList:!0,characterData:!0})),!1;if(void 0===t.controlInstances[n]){var a=!0;e.each(WPGlobusCustomize.elementSelector,function(o,s){var l=i.container.find(s);if(0!=l.length){if("function"!=typeof i.setting)return!0;t.controlInstances[n]={},t.controlInstances[n].element=l,t.controlInstances[n].elementID=l.attr("id")?"#"+l.attr("id"):void 0,t.controlInstances[n].setting=i.setting(),t.controlInstances[n].selector=s,t.controlInstances[n].controlSelector=i.selector,t.controlInstances[n].type="",t.controlInstances[n].section=i.section(),t.controlInstances[n].title=null,t.controlInstances[n].userControl=null,t.controlInstances[n].fieldSettings={},t.controlInstances[n].fieldSettings.itemID="item-wpglobus-cb-control-"+WPGlobusDialogApp.convertToId(n),t.controlInstances[n].fieldSettings.cbID="wpglobus-cb-control-"+WPGlobusDialogApp.convertToId(n),e.each(WPGlobusCustomize.setLinkBy,function(o,s){if(n.indexOf(s)>=0){if(t.controlInstances[n].type="link",""==t.controlInstances[n].setting&&(t.controlInstances[n].setting=l[0].defaultValue),WPGlobusCustomize.changeset_uuid){var i=wp.customize.control(n).setting();if(-1!==i.indexOf("|||")){var a=t.getTranslations(i);wp.customize.control(n).setting(a[WPGlobusCoreData.default_language]),e(WPGlobusCustomize.controlInstances[n].controlSelector+" "+WPGlobusCustomize.controlInstances[n].selector).val(a[WPGlobusCoreData.default_language])}}l.addClass("wpglobus-control-link")}}),""===t.controlInstances[n].type&&(t.controlInstances[n].type="textarea"==s?"textarea":"text"),l.val(WPGlobusCore.TextFilter(t.controlInstances[n].setting,WPGlobusCoreData.language,"RETURN_EMPTY")),l.addClass("wpglobus-customize-control"),l.attr("data-wpglobus-customize-control",t.controlInstances[n].controlSelector.replace("#customize-control-","")),"link"==t.controlInstances[n].type&&(t.controlInstances[n].setting=t.convertString(l[0].defaultValue)),t.controlInstances[n].title=i.params.label,null!==WPGlobusCustomizeOptions.userControl&&void 0!==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName]&&void 0!==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName][n]&&"disable"==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName][n]&&(a=!1),t.controlInstances[n].userControl={},t.controlInstances[n].userControl.enabled=a,t.setUserControls(n,t.controlInstances[n])}})}}},setControlInstances:function(){wp.customize.control.each(t.ctrlCallback)},setTitle:function(){e(WPGlobusCoreData.customize.info.element).html(WPGlobusCoreData.customize.info.html)},convertString:function(t){if(void 0===t)return t;var o=[],n=WPGlobusCore.getTranslations(t),s=0,l=!0;return t==n[WPGlobusCoreData.default_language]?t:(e.each(n,function(e,t){""==t?o[s]="null":(l=!1,o[s]=t),s++}),l?"":o.join("|||"))},getTranslations:function(t){if(void 0===t)return t;var o={},n=t.split("|||");return e.each(WPGlobusCoreData.enabled_languages,function(e,t){o[t]=void 0===n[e]||"null"===n[e]?"":n[e]}),o},getString:function(o,n,s){if(void 0===o)return o;void 0===n&&(n=""),void 0===s&&(s=WPGlobusCoreData.language);var l=t.getTranslations(o),i=[],a=0,c=!0;return e.each(l,function(e,t){e==s?(n=n.trim(),i[a]=""==n?"null":n):i[a]=""==t?"null":t,e!=WPGlobusCoreData.default_language&&"null"!=i[a]&&(c=!1),a++}),i=c?i[0]:i.join("|||")},addLanguageSelector:function(){"dropdown"!=WPGlobusCustomize.selectorType?(e(WPGlobusCustomize.selectorButton).insertAfter(".customize-controls-preview-toggle"),e(".wpglobus-customize-selector").html(t.selectorHtml.replace("{{language}}",WPGlobusCoreData.language)),e(document).on("click",".wpglobus-customize-selector",function(o){t.index>t.length-1?t.index=0:t.index++,WPGlobusCoreData.language=t.languages[t.index],e(this).html(t.selectorHtml.replace("{{language}}",WPGlobusCoreData.language)),e(document).triggerHandler("wpglobus_customize_control_language",[WPGlobusCoreData.language]),t.setControlsValue()})):t.addLanguageSelectorDropdown()},addLanguageSelectorDropdown:function(){e(WPGlobusCustomize.selectorButton).insertAfter(".customize-controls-preview-toggle"),e(".wpglobus-customize-selector").html(t.selectorHtml.replace("{{language}}",WPGlobusCoreData.language));var o=e(".wpglobus-customize-selector").offset(),n=o.top+46,s=0,l='<ul class="wpglobus-customize-selector-dropdown" style="display:none;position:fixed;width:46px;border-left:1px solid #ddd;border-right:1px solid #ddd;background-color:#eee;margin:-1px 0 0;padding:0;top:'+(n+="px;")+"left:"+(o.left+"px;")+'">';e.each(WPGlobusCoreData.enabled_languages,function(e,t){l+='<li class="item" style="text-align:center;cursor:pointer;border-bottom:1px solid #ddd;margin:0;" data-language="'+t+'">',l+='<span class="value value-'+t+'" style="font-size:15px;">'+t+"</span>",l+="</li>"}),l+='<li class="item wpglobus-customize-item-settings" style="text-align:center;cursor:pointer;border-bottom:1px solid #ddd;margin:0;"><span style="padding-top:14px;" class="dashicons dashicons-admin-tools"></span></li>',l+="</ul>",e(".wpglobus-customize-selector").after(l),e(document).on("mouseenter",".wpglobus-customize-selector",function(t){e(".wpglobus-customize-selector-dropdown").css({display:"block"}),s=t.screenY}),e(document).on("mouseleave",".wpglobus-customize-selector",function(t){0!=s&&t.screenY-s<=0&&e(".wpglobus-customize-selector-dropdown").css({display:"none"})}),e(document).on("mouseleave",".wpglobus-customize-selector-dropdown",function(t){e(".wpglobus-customize-selector-dropdown").css({display:"none"})}),e(document).on("mouseenter",".wpglobus-customize-selector-dropdown .item",function(t){var o=e(this),n=o.data("language");o.addClass("active"),o.css({"background-color":"#fff"}),o.find(".value-"+n).css({"font-weight":"bold"})}),e(document).on("mouseleave",".wpglobus-customize-selector-dropdown .item",function(t){var o=e(this);o.removeClass("active"),o.css({"background-color":"#eee"}),e(this).find(".value").css({"font-weight":""})}),e(document).on("click",".wpglobus-customize-selector-dropdown .item",function(o){var n=e(this).data("language");void 0!==n&&n!=e(".wpglobus-customize-selector").data("language")&&t.languageChanged(n)}),e(document).on("click",".wpglobus-customize-item-settings",function(o){wp.customize.control("wpglobus_fields_settings_section").expand({completeCallback:t.settingsSectionExpand}),e(".wpglobus-customize-selector-dropdown").css({display:"none"})})},languageChanged:function(o){WPGlobusCoreData.language=o,e(".wpglobus-customize-selector").data("language",o),e(".wpglobus-customize-selector .current-language").text(o),e(document).triggerHandler("wpglobus_customize_control_language",[WPGlobusCoreData.language]),t.setControlsValue()},setControlsValue:function(){e(".wpglobus-customize-control").each(function(o,n){var s=e(n),l=s.data("customize-setting-link");if(void 0!==WPGlobusCustomize.controlInstances[l]||(l=s.data("wpglobus-customize-control"),void 0!==WPGlobusCustomize.controlInstances[l]))if(s.hasClass("wpglobus-control-link")){var i=t.getTranslations(WPGlobusCustomize.controlInstances[l].setting);s.val(i[WPGlobusCoreData.language])}else{i=WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[l].setting,WPGlobusCoreData.language,"RETURN_EMPTY");"tinymce"==WPGlobusCustomize.controlInstances[l].type&&tinymce.get(l).setContent(i,{format:"raw"}),s.val(WPGlobusCore.TextFilter(i,"RETURN_EMPTY"))}}),e(".wpglobus-customize-widget-control").each(function(t,o){var n=e(o),s=n.data("widget");if(void 0===n.attr("id"))return!0;n.val(WPGlobusCore.TextFilter(WPGlobusCustomize.controlWidgets[s].element[n.attr("id")].value,WPGlobusCoreData.language,"RETURN_EMPTY"))})},updateElements:function(o){void 0===o&&(o=!0),e.each(WPGlobusCustomize.controlInstances,function(e,n){if(!n.userControl.enabled)return!0;var s=wp.customize.control.instance(e);if("link"==n.type){var l=t.getTranslations(WPGlobusCustomize.controlInstances[e].setting);o?(s.setting.set(l[WPGlobusCoreData.language]),n.element.val(s.setting())):n.element.val(l[WPGlobusCoreData.language])}else if("tinymce"==n.type){l=WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[e].setting,WPGlobusCoreData.language,"RETURN_EMPTY");tinymce.get(e).setContent(l,{format:"raw"}),n.element.val(l)}else o?(s.setting.set(WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[e].setting,WPGlobusCoreData.language,"RETURN_EMPTY")),n.element.val(s.setting())):n.element.val(WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[e].setting,WPGlobusCoreData.language,"RETURN_EMPTY"))})},onSubmitEvents:function(o){"mouseenter"==o.type?e.each(t.controlWidgets[e(this).data("widget")].element,function(t,o){e("#"+t).val(o.value)}):"mouseleave"==o.type?t.widgetKeep||e.each(t.controlWidgets[e(this).data("widget")].element,function(t,o){e("#"+t).val(WPGlobusCore.TextFilter(o.value,WPGlobusCoreData.language,"RETURN_EMPTY"))}):"click"==o.type&&(t.widgetKeep=!0)},attachWidgetListeners:function(o){void 0!==o.submit[0].id&&e(document).on("mouseenter","#"+o.submit[0].id,t.onSubmitEvents).on("mouseleave","#"+o.submit[0].id,t.onSubmitEvents).on("click","#"+o.submit[0].id,t.onSubmitEvents)},attachListeners:function(){e(".wpglobus-customize-control").on("keyup",function(o){var n=e(this),s=n.data("customize-setting-link");void 0===WPGlobusCustomize.controlInstances[s]&&(s=n.data("wpglobus-customize-control"),WPGlobusCustomize.controlInstances[s]),void 0===e(document).triggerHandler("wpglobus_customize_control_keyup",[n,s])&&("link"==WPGlobusCustomize.controlInstances[s].type?WPGlobusCustomize.controlInstances[s].setting=t.getString(WPGlobusCustomize.controlInstances[s].setting,n.val(),WPGlobusCoreData.language):WPGlobusCustomize.controlInstances[s].setting=WPGlobusCore.getString(WPGlobusCustomize.controlInstances[s].setting,n.val(),WPGlobusCoreData.language))}),e(document).on("keyup",".wpglobus-customize-widget-control",function(t){var o=e(this),n=o.data("widget");void 0!==WPGlobusCustomize.controlWidgets[n]&&(WPGlobusCustomize.controlWidgets[n].element[o.attr("id")].value=WPGlobusCore.getString(WPGlobusCustomize.controlWidgets[n].element[o.attr("id")].value,o.val(),WPGlobusCoreData.language))}),e(document).on("mouseenter","#save",function(t){e.each(WPGlobusCustomize.controlInstances,function(e,t){if(t.userControl.enabled){var o=wp.customize.control.instance(e);"tinymce"==t.type&&tinymce.get(e).setContent(t.setting,{format:"raw"}),o.setting.set(t.setting),t.element.val(o.setting())}})}).on("mouseleave","#save",function(e){t.instancesKeep||(t.updateElements(),wp.customize.previewer.refresh())}),e("#save").on("click",function(e){t.instancesKeep=!0}),e(document).on("ajaxSend",function(e,o,n){void 0!==n.data&&-1!=n.data.indexOf("wp_customize=on")&&-1!=n.data.indexOf("action=customize_save")&&(t.customizeSave=!0)}),e(document).on("ajaxComplete",function(o,n){void 0!==n.responseText&&(t.customizeSave?(t.updateElements(!1),t.instancesKeep&&(t.instancesKeep=!1)):(n.responseText.indexOf("WP_CUSTOMIZER_SIGNATURE")>=0&&(t.action="customizerAjaxComplete",t.setControlInstances()),e.each(WPGlobusCustomize.controlWidgets,function(o,s){var l=o.replace("_","-");if(n.responseText.indexOf(l)>=0)return s.submit.css({display:"block"}),s.control.liveUpdateMode=!1,e.each(s.element,function(t,o){e("#"+t).val(WPGlobusCore.TextFilter(o.value,WPGlobusCoreData.language,"RETURN_EMPTY"))}),s.inWidgetTitle.text(": "+WPGlobusCore.TextFilter(s.control.setting().title,WPGlobusCustomize.languageAdmin)),t.widgetKeep=!1,!1})),t.customizeSave=!1,wp.customize.previewer.refresh())})}};WPGlobusCustomize=e.extend({},WPGlobusCustomize,t),WPGlobusCustomize.init()});
1
+ jQuery(document).ready(function(c){"use strict";var u={languages:{},index:0,length:0,controlInstances:{},controlWidgets:{},instancesKeep:!1,widgetKeep:!1,action:!1,customizeSave:!1,selectorHtml:'<span style="margin-left:5px;" class="wpglobus-icon-globe"></span><span class="current-language" style="font-weight:bold;">{{language}}</span>',settingsSectionExpand:function(){c(document).triggerHandler("wpglobus_fields_settings_section_expand",[this,u])},init:function(e){u.setTitle(),"false"!=WPGlobusCustomizeOptions.themeEnabled&&(c.each(WPGlobusCoreData.enabled_languages,function(e,t){u.languages[e]=t,u.length=e}),u.addLanguageSelector(),u.setControlInstances(),u.setFieldsSection(),u.attachListeners(),u.setTinymce())},updateTinymce:function(e){"tinymce"==WPGlobusCustomize.controlInstances[this.id].type&&(WPGlobusCustomize.controlInstances[this.id].setting=WPGlobusCore.getString(WPGlobusCustomize.controlInstances[this.id].setting,e.target.textContent,WPGlobusCoreData.language))},setTinymce:function(e){c(document).on("tinymce-editor-init",function(e,t){"object"==typeof u.controlInstances[t.id]&&(u.controlInstances[t.id].type="tinymce",c(t.iframeElement).addClass("wpglobus-customize-control").css({width:"99%"}),t.on("input",_.debounce(u.updateTinymce,300)))})},getSize:function(e){return void 0===e?_.size(u.controlInstances):"widget"==e?_.size(u.controlWidgets):null},setFieldsSection:function(){var o={},n=c(".wpglobus-fields_settings_control_box").data("section-template"),s="",l="",i="";c.each(WPGlobusCustomize.controlInstances,function(e,t){void 0===o[t.section]&&(o[t.section]={}),o[t.section][e]=t}),c.each(o,function(e,t){if(l="<ul>",c.each(t,function(e,t){i=t.userControl.enabled?" checked ":"",l+='<li id="'+t.fieldSettings.itemID+'">',l+='<input id="'+t.fieldSettings.cbID+'" data-control="'+e+'" class="wpglobus-customize-cb-control" type="checkbox"'+i+' /> <span class="wpglobus-cb-control-title">'+t.title+"</span>",l+="</li>"}),l+="</ul>",void 0===wp.customize.section(e))return!0;s=(s=(s=(s=n.replace("{{section_title}}",wp.customize.section(e).params.title)).replace(/{{section}}/g,e)).replace("{{section_id}}",'"'+e+'"')).replace("{{items}}",l),c(s).insertBefore(c("#"+WPGlobusCustomizeOptions.userControlSaveButton))}),c("#accordion-section-wpglobus_fields_settings_section").css({"margin-top":"15px"}),c(WPGlobusCustomizeOptions.helpButton).insertAfter(c("#accordion-section-wpglobus_fields_settings_section .customize-action")),c("#accordion-section-wpglobus_fields_settings_section .customize-section-description").addClass("hidden"),c(document).on("click","."+WPGlobusCustomizeOptions.userControlIconClass,function(e){var o=c(this).data("section");c(WPGlobusCustomizeOptions.userControlBoxSelector).each(function(e,t){o==c(t).data("section")?c(this).css({display:"block"}):c(this).css({display:"none"})}),wp.customize.control("wpglobus_fields_settings_section").expand({completeCallback:u.settingsSectionExpand})}),c(".wpglobus-customize-icon-help.customize-help-toggle").on("click",function(e){c("#accordion-section-wpglobus_fields_settings_section .customize-section-description").toggleClass("hidden")})},setUserControls:function(e,t){var o=t.controlSelector+" "+t.selector,n='<img class="'+WPGlobusCustomizeOptions.userControlIconClass+'" data-section="'+t.section+'" style="position:absolute;right:0px;cursor:pointer;" src="'+WPGlobusCustomizeOptions.userControlIcon+'" />';c(n).insertBefore(o),t.userControl.enabled||(1<c(o).length?c(o).each(function(e,t){c(t).removeClass(WPGlobusCustomize.controlClass)}):c(o).removeClass(WPGlobusCustomize.controlClass).val(t.setting))},ctrlMenuItemsCallback:function(e,t){},ctrlWidgetCallback:function(l,i){if(u.action=!1,void 0===u.controlWidgets[l].element){void 0===i&&(i=wp.customize.control.instance(l)),u.controlWidgets[l].element={},u.controlWidgets[l].control=i,u.controlWidgets[l].inWidgetTitle=i.container.find(".in-widget-title"),u.controlWidgets[l].parent=i.selector;var e=i.container.find("input[type=submit]");0!=e.length&&(e.css({display:"block"}),e.attr("data-widget",l),u.controlWidgets[l].submit=e,u.attachWidgetListeners(u.controlWidgets[l])),i.liveUpdateMode=!1,void 0===i.setting().title?u.controlWidgets[l].inWidgetTitle.text(""):u.controlWidgets[l].inWidgetTitle.text(": "+WPGlobusCore.TextFilter(i.setting().title,WPGlobusCustomize.languageAdmin)),c.each(WPGlobusCustomize.elementSelector,function(e,n){var s=i.container.find(n);0!=s.length&&c.each(s,function(e,t){if(void 0===t.id||""==t.id)return!0;var o=c(s[e]);void 0===u.controlWidgets[l].element[t.id]&&(u.controlWidgets[l].element[t.id]={}),o.addClass("wpglobus-customize-widget-control"),o.attr("data-widget",l),u.controlWidgets[l].element[t.id].element=o,u.controlWidgets[l].element[t.id].setting=i.setting(),u.controlWidgets[l].element[t.id].selector=n,u.controlWidgets[l].element[t.id].value=t.defaultValue,o.val(WPGlobusCore.TextFilter(t.defaultValue,WPGlobusCoreData.language,"RETURN_EMPTY"))})}),c(document).triggerHandler("wpglobus_customize_control_added_widget",[l])}},ctrlCallback:function(o,l,e){var n=!1;if(c.each(WPGlobusCustomize.disabledSections,function(e,t){if(o.section()==t)return n=!0,!1}),!n&&(c.each(WPGlobusCustomize.disabledSettingMask,function(e,t){if(0<=l.indexOf(t))return n=!0,!1}),!n)){var i=wp.customize.control.instance(l);if(0<=l.indexOf("widget"))return void 0===u.controlWidgets[l]&&(u.controlWidgets[l]={},u.action&&u.ctrlWidgetCallback(l,i)),u.controlWidgets[l].parent=i.selector,1!=c(i.selector).length?u.controlWidgets[l].observer=null:(u.controlWidgets[l].observer=new MutationObserver(function(e){e.forEach(function(e){"class"==e.attributeName&&-1!=e.target.className.indexOf("expanding")&&u.ctrlWidgetCallback(l)})}),u.controlWidgets[l].observer.observe(document.querySelector(u.controlWidgets[l].parent),{attributes:!0,childList:!0,characterData:!0})),!1;if(void 0===u.controlInstances[l]){var a=!0;c.each(WPGlobusCustomize.elementSelector,function(e,t){var s=i.container.find(t);if(0!=s.length){if("function"!=typeof i.setting)return!0;u.controlInstances[l]={},u.controlInstances[l].element=s,u.controlInstances[l].elementID=s.attr("id")?"#"+s.attr("id"):void 0,u.controlInstances[l].setting=i.setting(),u.controlInstances[l].selector=t,u.controlInstances[l].controlSelector=i.selector,u.controlInstances[l].type="",u.controlInstances[l].section=i.section(),u.controlInstances[l].title=null,u.controlInstances[l].userControl=null,u.controlInstances[l].fieldSettings={},u.controlInstances[l].fieldSettings.itemID="item-wpglobus-cb-control-"+WPGlobusDialogApp.convertToId(l),u.controlInstances[l].fieldSettings.cbID="wpglobus-cb-control-"+WPGlobusDialogApp.convertToId(l),c.each(WPGlobusCustomize.setLinkBy,function(e,t){if(0<=l.indexOf(t)){if(u.controlInstances[l].type="link",""==u.controlInstances[l].setting&&(u.controlInstances[l].setting=s[0].defaultValue),WPGlobusCustomize.changeset_uuid){var o=wp.customize.control(l).setting();if(-1!==o.indexOf("|||")){var n=u.getTranslations(o);wp.customize.control(l).setting(n[WPGlobusCoreData.default_language]),c(WPGlobusCustomize.controlInstances[l].controlSelector+" "+WPGlobusCustomize.controlInstances[l].selector).val(n[WPGlobusCoreData.default_language])}}s.addClass("wpglobus-control-link")}}),""===u.controlInstances[l].type&&(u.controlInstances[l].type="textarea"==t?"textarea":"text"),s.val(WPGlobusCore.TextFilter(u.controlInstances[l].setting,WPGlobusCoreData.language,"RETURN_EMPTY")),s.addClass("wpglobus-customize-control"),s.attr("data-wpglobus-customize-control",u.controlInstances[l].controlSelector.replace("#customize-control-","")),"link"==u.controlInstances[l].type&&(u.controlInstances[l].setting=u.convertString(s[0].defaultValue)),u.controlInstances[l].title=i.params.label,null!==WPGlobusCustomizeOptions.userControl&&void 0!==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName]&&void 0!==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName][l]&&"disable"==WPGlobusCustomizeOptions.userControl[WPGlobusCustomizeOptions.themeName][l]&&(a=!1),u.controlInstances[l].userControl={},u.controlInstances[l].userControl.enabled=a,u.setUserControls(l,u.controlInstances[l])}})}}},setControlInstances:function(){wp.customize.control.each(u.ctrlCallback)},setTitle:function(){c(WPGlobusCoreData.customize.info.element).html(WPGlobusCoreData.customize.info.html)},convertString:function(e){if(void 0===e)return e;var o=[],t=WPGlobusCore.getTranslations(e),n=0,s=!0;return e==t[WPGlobusCoreData.default_language]?e:(c.each(t,function(e,t){""==t?o[n]="null":(s=!1,o[n]=t),n++}),s?"":o.join("|||"))},getTranslations:function(e){if(void 0===e)return e;var o={},n=e.split("|||");return c.each(WPGlobusCoreData.enabled_languages,function(e,t){o[t]=void 0===n[e]||"null"===n[e]?"":n[e]}),o},getString:function(e,o,n){if(void 0===e)return e;void 0===o&&(o=""),void 0===n&&(n=WPGlobusCoreData.language);var t=u.getTranslations(e),s=[],l=0,i=!0;return c.each(t,function(e,t){e==n?(o=o.trim(),s[l]=""==o?"null":o):s[l]=""==t?"null":t,e!=WPGlobusCoreData.default_language&&"null"!=s[l]&&(i=!1),l++}),s=i?s[0]:s.join("|||")},addLanguageSelector:function(){"dropdown"!=WPGlobusCustomize.selectorType?(c(WPGlobusCustomize.selectorButton).insertAfter(".customize-controls-preview-toggle"),c(".wpglobus-customize-selector").html(u.selectorHtml.replace("{{language}}",WPGlobusCoreData.language)),c(document).on("click",".wpglobus-customize-selector",function(e){u.index>u.length-1?u.index=0:u.index++,WPGlobusCoreData.language=u.languages[u.index],c(this).html(u.selectorHtml.replace("{{language}}",WPGlobusCoreData.language)),c(document).triggerHandler("wpglobus_customize_control_language",[WPGlobusCoreData.language]),u.setControlsValue()})):u.addLanguageSelectorDropdown()},addLanguageSelectorDropdown:function(){c(WPGlobusCustomize.selectorButton).insertAfter(".customize-controls-preview-toggle"),c(".wpglobus-customize-selector").html(u.selectorHtml.replace("{{language}}",WPGlobusCoreData.language));var e=c(".wpglobus-customize-selector").offset(),t=e.top+46;t+="px;";var o=e.left+"px;",n=0,s='<ul class="wpglobus-customize-selector-dropdown" style="display:none;position:fixed;width:46px;border-left:1px solid #ddd;border-right:1px solid #ddd;background-color:#eee;margin:-1px 0 0;padding:0;top:'+t+"left:"+o+'">';c.each(WPGlobusCoreData.enabled_languages,function(e,t){s+='<li class="item" style="text-align:center;cursor:pointer;border-bottom:1px solid #ddd;margin:0;" data-language="'+t+'">',s+='<span class="value value-'+t+'" style="font-size:15px;">'+t+"</span>",s+="</li>"}),s+='<li class="item wpglobus-customize-item-settings" style="text-align:center;cursor:pointer;border-bottom:1px solid #ddd;margin:0;"><span style="padding-top:14px;" class="dashicons dashicons-admin-tools"></span></li>',s+="</ul>",c(".wpglobus-customize-selector").after(s),c(document).on("mouseenter",".wpglobus-customize-selector",function(e){c(".wpglobus-customize-selector-dropdown").css({display:"block"}),n=e.screenY}),c(document).on("mouseleave",".wpglobus-customize-selector",function(e){0!=n&&e.screenY-n<=0&&c(".wpglobus-customize-selector-dropdown").css({display:"none"})}),c(document).on("mouseleave",".wpglobus-customize-selector-dropdown",function(e){c(".wpglobus-customize-selector-dropdown").css({display:"none"})}),c(document).on("mouseenter",".wpglobus-customize-selector-dropdown .item",function(e){var t=c(this),o=t.data("language");t.addClass("active"),t.css({"background-color":"#fff"}),t.find(".value-"+o).css({"font-weight":"bold"})}),c(document).on("mouseleave",".wpglobus-customize-selector-dropdown .item",function(e){var t=c(this);t.removeClass("active"),t.css({"background-color":"#eee"}),c(this).find(".value").css({"font-weight":""})}),c(document).on("click",".wpglobus-customize-selector-dropdown .item",function(e){var t=c(this).data("language");void 0!==t&&t!=c(".wpglobus-customize-selector").data("language")&&u.languageChanged(t)}),c(document).on("click",".wpglobus-customize-item-settings",function(e){wp.customize.control("wpglobus_fields_settings_section").expand({completeCallback:u.settingsSectionExpand}),c(".wpglobus-customize-selector-dropdown").css({display:"none"})})},languageChanged:function(e){WPGlobusCoreData.language=e,c(".wpglobus-customize-selector").data("language",e),c(".wpglobus-customize-selector .current-language").text(e),c(document).triggerHandler("wpglobus_customize_control_language",[WPGlobusCoreData.language]),u.setControlsValue()},setControlsValue:function(){c(".wpglobus-customize-control").each(function(e,t){var o=c(t),n=o.data("customize-setting-link");if(void 0!==WPGlobusCustomize.controlInstances[n]||(n=o.data("wpglobus-customize-control"),void 0!==WPGlobusCustomize.controlInstances[n]))if(o.hasClass("wpglobus-control-link")){var s=u.getTranslations(WPGlobusCustomize.controlInstances[n].setting);o.val(s[WPGlobusCoreData.language])}else{s=WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[n].setting,WPGlobusCoreData.language,"RETURN_EMPTY");"tinymce"==WPGlobusCustomize.controlInstances[n].type&&tinymce.get(n).setContent(s,{format:"raw"}),o.val(WPGlobusCore.TextFilter(s,"RETURN_EMPTY"))}}),c(".wpglobus-customize-widget-control").each(function(e,t){var o=c(t),n=o.data("widget");if(void 0===o.attr("id"))return!0;o.val(WPGlobusCore.TextFilter(WPGlobusCustomize.controlWidgets[n].element[o.attr("id")].value,WPGlobusCoreData.language,"RETURN_EMPTY"))})},updateElements:function(s){void 0===s&&(s=!0),c.each(WPGlobusCustomize.controlInstances,function(e,t){if(!t.userControl.enabled)return!0;var o=wp.customize.control.instance(e);if("link"==t.type){var n=u.getTranslations(WPGlobusCustomize.controlInstances[e].setting);s?(o.setting.set(n[WPGlobusCoreData.language]),t.element.val(o.setting())):t.element.val(n[WPGlobusCoreData.language])}else if("tinymce"==t.type){n=WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[e].setting,WPGlobusCoreData.language,"RETURN_EMPTY");tinymce.get(e).setContent(n,{format:"raw"}),t.element.val(n)}else s?(o.setting.set(WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[e].setting,WPGlobusCoreData.language,"RETURN_EMPTY")),t.element.val(o.setting())):t.element.val(WPGlobusCore.TextFilter(WPGlobusCustomize.controlInstances[e].setting,WPGlobusCoreData.language,"RETURN_EMPTY"))})},onSubmitEvents:function(e){"mouseenter"==e.type?c.each(u.controlWidgets[c(this).data("widget")].element,function(e,t){c("#"+e).val(t.value)}):"mouseleave"==e.type?u.widgetKeep||c.each(u.controlWidgets[c(this).data("widget")].element,function(e,t){c("#"+e).val(WPGlobusCore.TextFilter(t.value,WPGlobusCoreData.language,"RETURN_EMPTY"))}):"click"==e.type&&(u.widgetKeep=!0)},attachWidgetListeners:function(e){void 0!==e.submit[0].id&&c(document).on("mouseenter","#"+e.submit[0].id,u.onSubmitEvents).on("mouseleave","#"+e.submit[0].id,u.onSubmitEvents).on("click","#"+e.submit[0].id,u.onSubmitEvents)},attachListeners:function(){c(".wpglobus-customize-control").on("keyup",function(e){var t=c(this),o=t.data("customize-setting-link");void 0===WPGlobusCustomize.controlInstances[o]&&(o=t.data("wpglobus-customize-control"),WPGlobusCustomize.controlInstances[o]),void 0===c(document).triggerHandler("wpglobus_customize_control_keyup",[t,o])&&("link"==WPGlobusCustomize.controlInstances[o].type?WPGlobusCustomize.controlInstances[o].setting=u.getString(WPGlobusCustomize.controlInstances[o].setting,t.val(),WPGlobusCoreData.language):WPGlobusCustomize.controlInstances[o].setting=WPGlobusCore.getString(WPGlobusCustomize.controlInstances[o].setting,t.val(),WPGlobusCoreData.language))}),c(document).on("keyup",".wpglobus-customize-widget-control",function(e){var t=c(this),o=t.data("widget");void 0!==WPGlobusCustomize.controlWidgets[o]&&(WPGlobusCustomize.controlWidgets[o].element[t.attr("id")].value=WPGlobusCore.getString(WPGlobusCustomize.controlWidgets[o].element[t.attr("id")].value,t.val(),WPGlobusCoreData.language))}),c(document).on("mouseenter","#save",function(e){c.each(WPGlobusCustomize.controlInstances,function(e,t){if(t.userControl.enabled){var o=wp.customize.control.instance(e);"tinymce"==t.type&&tinymce.get(e).setContent(t.setting,{format:"raw"}),o.setting.set(t.setting),t.element.val(o.setting())}})}).on("mouseleave","#save",function(e){u.instancesKeep||(u.updateElements(),wp.customize.previewer.refresh())}),c("#save").on("click",function(e){u.instancesKeep=!0}),c(document).on("ajaxSend",function(e,t,o){void 0!==o.data&&-1!=o.data.indexOf("wp_customize=on")&&-1!=o.data.indexOf("action=customize_save")&&(u.customizeSave=!0)}),c(document).on("ajaxComplete",function(e,n){void 0!==n.responseText&&(u.customizeSave?(u.updateElements(!1),u.instancesKeep&&(u.instancesKeep=!1)):(0<=n.responseText.indexOf("WP_CUSTOMIZER_SIGNATURE")&&(u.action="customizerAjaxComplete",u.setControlInstances()),c.each(WPGlobusCustomize.controlWidgets,function(e,t){var o=e.replace("_","-");if(0<=n.responseText.indexOf(o))return t.submit.css({display:"block"}),t.control.liveUpdateMode=!1,c.each(t.element,function(e,t){c("#"+e).val(WPGlobusCore.TextFilter(t.value,WPGlobusCoreData.language,"RETURN_EMPTY"))}),t.inWidgetTitle.text(": "+WPGlobusCore.TextFilter(t.control.setting().title,WPGlobusCustomize.languageAdmin)),u.widgetKeep=!1})),u.customizeSave=!1,wp.customize.previewer.refresh())})}};WPGlobusCustomize=c.extend({},WPGlobusCustomize,u),WPGlobusCustomize.init()});
includes/js/wpglobus-customize-options.js CHANGED
@@ -1,411 +1,411 @@
1
- /**
2
- * WPGlobus Customize Options
3
- * Interface JS functions
4
- *
5
- * @since 1.4.6
6
- *
7
- * @package WPGlobus
8
- * @subpackage Customize Options
9
- */
10
- /*jslint browser: true*/
11
- /*global jQuery, console, WPGlobusCore, WPGlobusCoreData, WPGlobusCustomizeOptions*/
12
- jQuery(document).ready(function ($) {
13
- "use strict";
14
-
15
- var api = {
16
- listID: '#wpglobus-sortable',
17
- customizeSave: false,
18
- customizeSaveData: '',
19
- init: function() {
20
- $( '#wpglobus-sortable' ).sortable({
21
- update: api.sortUpdate
22
- });
23
- api.setJSCodeSection();
24
- api.addListeners();
25
- api.ajaxListener();
26
- },
27
- setJSCodeSection: function() {
28
- var el = WPGlobusCustomizeOptions.settings['wpglobus_js_editor_section'];
29
- if ( 'undefined' === typeof el ) {
30
- return;
31
- }
32
- if ( 'undefined' === typeof el['wpglobus_customize_js_editor'] ) {
33
- return
34
- }
35
- $('#customize-control-wpglobus_customize_js_editor .customize-control-title')
36
- .css({'width':'50%'})
37
- .after('<span class="wpglobus-customize-js-editor-expand" style="float:right;"><a href="#">'+WPGlobusCustomizeOptions.i18n['expandShrink']+'</a></span>');
38
-
39
- /**
40
- * Expand/Shrink editor.
41
- */
42
- $(document).on('click', '.wpglobus-customize-js-editor-expand', function(ev){
43
- var $t = $(this),
44
- $f = $('#customize-controls');
45
- $t.toggleClass('expanded');
46
- if ( $t.hasClass('expanded') ) {
47
- $f.css({'width':'500px'});
48
- } else {
49
- $f.css({'width':''});
50
- }
51
- });
52
-
53
- /**
54
- * Set defaults.
55
- */
56
- $('#sub-accordion-section-wpglobus_js_editor_section .customize-section-back').on('click', function(ev){
57
- $('#customize-controls').css({'width':''});
58
- $('.wpglobus-customize-js-editor-expand').removeClass('expanded');
59
- });
60
-
61
- },
62
- addListeners: function() {
63
-
64
- $( 'body' ).on( 'change', '.wpglobus-listen-change', function(ev){
65
- api.setState( false );
66
- });
67
-
68
- $( 'body' ).on( 'change', '#wpglobus-sortable input.wpglobus-language-item', function(ev){
69
- var $t = $( this );
70
- if ( ! $t.prop( 'checked' ) ) {
71
- api.removeLanguage( $t );
72
- }
73
- });
74
-
75
- $( '#customize-control-wpglobus_add_languages_select_box select' ).on(
76
- 'change',
77
- function(event){
78
- api.addLanguage( event, this );
79
- }
80
- );
81
-
82
- /** open Addons page in new tab */
83
- $( '#accordion-section-' + WPGlobusCustomizeOptions.sections.wpglobus_addons_section + ' .accordion-section-title' ).off( 'click keydown' );
84
- $( 'body' ).on(
85
- 'click',
86
- '#accordion-section-' + WPGlobusCustomizeOptions.sections.wpglobus_addons_section + ' .accordion-section-title',
87
- function(ev) {
88
- window.open( WPGlobusCustomizeOptions.addonsPage, '_blank' );
89
- }
90
- );
91
-
92
- /** Save Fields Control settings & Reload customize page */
93
- $( document ).on( 'click', '#' + WPGlobusCustomizeOptions.userControlSaveButton, function(){ api.userControlAjax( this ) } );
94
-
95
- /**
96
- * Init for wpglobus_js_editor_section.
97
- * @since 1.9.7
98
- */
99
- $(document).on(
100
- 'click',
101
- '#accordion-section-' + WPGlobusCustomizeOptions.sections.wpglobus_js_editor_section + ' .accordion-section-title',
102
- function(ev) {
103
- /**
104
- * Fix Code Editor height.
105
- */
106
- $('#customize-control-wpglobus_customize_js_editor .CodeMirror').css({'height':'40em'});
107
- }
108
- );
109
- },
110
- removeLanguage: function( t ) {
111
- var l = t.data( 'language' ),
112
- e = $( '#customize-control-wpglobus_add_languages_select_box select option' ).eq(0);
113
- $( '<option value="'+l+'">' +
114
- WPGlobusCustomizeOptions.config.language_name[l] + ' (' + WPGlobusCustomizeOptions.config.en_language_name[l] + ') ' +
115
- '</option>' ).insertAfter( e );
116
- t.parent('li').remove();
117
- },
118
- addLanguage: function( event, t ) {
119
- var code = $(t).attr( 'value' ),
120
- s = $( '#wpglobus-item-skeleton' ).html(),
121
- item = '',
122
- li_class = $( api.listID + ' li').attr( 'class' );
123
-
124
- if ( code == 'select' ) return;
125
-
126
- item = s.replace(
127
- '{{flag}}',
128
- 'src="' +WPGlobusCustomizeOptions.config.flags_url + WPGlobusCustomizeOptions.config.flag[code] + '"'
129
- );
130
- item = item.replace( '{{name}}', code );
131
- item = item.replace( '{{id}}', code );
132
- item = item.replace( 'checked="{{checked}}"', 'checked="checked"' );
133
- item = item.replace( 'disabled="{{disabled}}"', '' );
134
- item = item.replace( '{{item}}', WPGlobusCustomizeOptions.config.en_language_name[ code ] + ' (' +code+ ') ' );
135
- item = item.replace( '{{order}}', '#' );
136
- item = item.replace( '{{language}}', code );
137
- item = item.replace( '{{edit-link}}', WPGlobusCustomizeOptions.editLink.replace( '{{language}}', code ) );
138
- $( '<li class="' + li_class + '">' + item + '</li>' ).appendTo( api.listID );
139
- api.setOrder();
140
-
141
- var opts = $(t).find( 'option' );
142
- $.each( opts, function(i, e) {
143
- if ( $(e).attr('value') == code ) {
144
- $(e).remove();
145
- }
146
- });
147
-
148
- },
149
- sortUpdate: function( event, ui ) {
150
- api.setState( false );
151
- api.setOrder();
152
- },
153
- setOrder: function() {
154
-
155
- $( '#wpglobus-sortable input.wpglobus-language-item' ).each( function( i, e ){
156
- var $e = $(e);
157
- if ( i == 0 ) {
158
- $e.prop( 'disabled', 'disabled' ).prop( 'checked', 'checked' );
159
- } else {
160
- $e.removeProp( 'disabled' );
161
- }
162
- $e.data( 'order', i );
163
- } );
164
-
165
- },
166
- setState: function( state ) {
167
- wp.customize.state( 'saved' ).set( state );
168
- },
169
- getCustomizeSaveData: function() {
170
- return api.customizeSaveData;
171
- },
172
- enabledUserControl: function(setting) {
173
- if ( 'undefined' === typeof WPGlobusCustomize.controlInstances[setting] ) {
174
- return false;
175
- }
176
- return WPGlobusCustomize.controlInstances[setting].userControl.enabled;
177
- },
178
- userControlAjax: function( btn ) {
179
-
180
- $( btn ).prop( 'disabled', true );
181
-
182
- var order = {};
183
- order[ 'action' ] = 'cb-controls-save';
184
- order[ 'controls' ] = {};
185
- $( '.wpglobus-customize-cb-control' ).each( function(i, cb){
186
- var $t = $( cb );
187
- if ( $t.prop( 'checked' ) ) {
188
- // do nothing
189
- } else {
190
- var ctrl = $t.data( 'control' );
191
- ctrl = ctrl.replace( '[', '{{');
192
- ctrl = ctrl.replace( ']', '}}');
193
- order[ 'controls' ][ ctrl ] = 'disable';
194
- }
195
- });
196
-
197
- $.ajax({
198
- beforeSend:function(){},
199
- type: 'POST',
200
- url: WPGlobusCustomizeOptions.ajaxurl,
201
- data: { action:WPGlobusCustomizeOptions.process_ajax, order:order },
202
- dataType: 'json'
203
- })
204
- .always(function() {
205
- location.reload(true);
206
- });
207
-
208
- },
209
- ajax: function(ajaxAction, data) {
210
-
211
- if ( 'wpglobus_customize_save' == ajaxAction ) {
212
-
213
- var order = {};
214
- order['action'] = 'wpglobus_customize_save';
215
- order['options'] = {};
216
-
217
- $.each( WPGlobusCustomizeOptions.settings, function( section, el ) {
218
-
219
- $.each( el, function( id, obj ) {
220
-
221
- if ( id == 'wpglobus_customize_enabled_languages' ) {
222
-
223
- order[ 'options' ][ obj.option ] = {};
224
- $( '#wpglobus-sortable input.wpglobus-language-item' ).each( function( i, e ) {
225
- order[ 'options' ][ obj.option ][ $(this).data('language') ] = '1';
226
- });
227
-
228
- return true;
229
- }
230
-
231
- if ( -1 != api.customizeSaveData.indexOf( 'wpglobus_customize_post_type_' ) &&
232
- -1 != id.indexOf( 'wpglobus_customize_post_type_' ) ) {
233
-
234
- if ( typeof order[ 'options' ][ obj.option ] === 'undefined' ) {
235
- order[ 'options' ][ obj.option ] = {};
236
- }
237
- order[ 'options' ][ obj.option ][ id.replace( 'wpglobus_customize_post_type_', '' ) ] =
238
- $( '#customize-control-' + id + ' input' ).prop( 'checked' ) ? 1 : 0;
239
-
240
- } else {
241
-
242
- if ( -1 != api.customizeSaveData.indexOf( id ) ) {
243
-
244
- var s = $( '#customize-control-' + id + ' ' + obj.type ),
245
- val = '';
246
-
247
- if ( 'textarea' == obj.type ) {
248
- val = s.val();
249
- } else if ( 'wpglobus_checkbox' == obj.type ) {
250
- s = $( '#customize-control-' + id + ' input' );
251
- if ( id == 'wpglobus_customize_selector_wp_list_pages' ) {
252
- val = s.prop( 'checked' ) ? 1 : 0;
253
- } else {
254
- val = s.prop( 'checked' ) ? 1 : '';
255
- }
256
- } else if ( 'checkbox' == obj.type ) {
257
- val = s.prop( 'checked' ) ? 1 : '';
258
- } else if ( 'select' == obj.type ) {
259
- val = s.val();
260
- } else if ( 'code_editor' == obj.type ) {
261
- var control = wp.customize.control.instance(id);
262
- if ( 'undefined' !== typeof control ) {
263
- val = control.setting();
264
- }
265
- }
266
- order['options'][obj.option] = val;
267
-
268
- if ( 'code_editor' == obj.type ) {
269
- if ( 'undefined' === typeof control ) {
270
- /**
271
- * If control is undefined then we don't need to save code.
272
- */
273
- delete order['options'][obj.option];
274
- }
275
- }
276
- }
277
- }
278
-
279
- });
280
-
281
- });
282
-
283
- }
284
-
285
- $.ajax({
286
- beforeSend:function(){},
287
- type: 'POST',
288
- url: WPGlobusCustomizeOptions.ajaxurl,
289
- data: { action:WPGlobusCustomizeOptions.process_ajax, order:order },
290
- dataType: 'json'
291
- });
292
- },
293
- getChangesetData: function(ajaxData) {
294
- /**
295
- * @since 1.7.9
296
- */
297
- if ( 'undefined' !== typeof ajaxData ) {
298
-
299
- var changesetData = /customize_changeset_data=([^&]+)/.exec(ajaxData);
300
-
301
- if ( 'undefined' === typeof changesetData[1] ) {
302
- return;
303
- }
304
-
305
- var settingsJson = decodeURIComponent( changesetData[1] );
306
- var settings = JSON.parse(settingsJson);
307
- var values, value;
308
-
309
- $.each( settings, function(setting, data) {
310
-
311
- if ( 'undefined' !== typeof WPGlobusCustomize.controlInstances[setting] ) {
312
-
313
- value = '';
314
- if ( 'link' == WPGlobusCustomize.controlInstances[setting]['type'] ) {
315
- if ( 1 ) {
316
- /**
317
- * In "customize changeset" post we must save URL with ||| delimiters
318
- * otherwise we lost value after validating "$setting->validate( $value )"
319
- * @see function post_value() in wp-includes\class-wp-customize-manager.php
320
- */
321
- value = WPGlobusCustomize.controlInstances[setting].setting;
322
- } else {
323
- /**
324
- * Using standard language marks {:en}url{:}.
325
- * This is correct code and approach but need to find ability to prevent validating.
326
- * @see upper comment.
327
- */
328
- values = WPGlobusCustomize.getTranslations( WPGlobusCustomize.controlInstances[setting].setting );
329
- /**
330
- * @todo make function to get string with language marks from object.
331
- */
332
- $.each(WPGlobusCoreData.enabled_languages, function(i,l){
333
- if ( '' != values[l] && 'undefined' !== typeof values[l] ) {
334
- value = value + WPGlobusCore.addLocaleMarks(values[l], l);
335
- }
336
- });
337
- }
338
- } else {
339
-
340
- value = WPGlobusCustomize.controlInstances[setting].setting;
341
-
342
- }
343
- settings[setting]['value'] = value;
344
- }
345
- });
346
-
347
- var newChangeset = JSON.stringify(settings);
348
- newChangeset = encodeURIComponent(newChangeset);
349
- newChangeset = newChangeset.replace( /%20/g, '+' );
350
-
351
- ajaxData = ajaxData.replace( changesetData[1], newChangeset );
352
-
353
- }
354
-
355
- return ajaxData;
356
- },
357
- ajaxListener: function() {
358
- /**
359
- * ajaxSend event handler
360
- */
361
- $( document ).on( 'ajaxSend', function( ev, jqXHR, ajaxOptions ) {
362
- if ( typeof ajaxOptions.data === 'undefined' ) {
363
- return;
364
- }
365
-
366
- if ( -1 != ajaxOptions.data.indexOf('wp_customize=on') && -1 != ajaxOptions.data.indexOf('action=customize_save') ) {
367
-
368
- if ( -1 != ajaxOptions.data.indexOf('customized=') ) {
369
- api.customizeSave = true;
370
- api.customizeSaveData = ajaxOptions.data;
371
- } else if ( -1 != ajaxOptions.data.indexOf('customize_changeset_data=') ) {
372
- /**
373
- * Ajax action when are saved changeset.
374
- *
375
- * @since 1.7.9
376
- */
377
- ajaxOptions.data = api.getChangesetData(ajaxOptions.data);
378
- }
379
-
380
- }
381
- });
382
-
383
- $( document ).on( 'ajaxComplete', function( ev, response, ajaxOptions ) {
384
- if ( typeof response.responseText === 'undefined' ) {
385
- return;
386
- }
387
- if ( api.customizeSave ) {
388
- api.customizeSave = false;
389
- api.ajax('wpglobus_customize_save');
390
- }
391
- });
392
-
393
- $( document ).on( 'ajaxStop', function() {
394
- /**
395
- * We need to use ajaxStop (together with ajaxComplete) event to make save options in Customizer
396
- * cause is Redux Framework makes unbind ajaxComplete event
397
- * @see https://github.com/reduxframework/redux-framework/issues/2896
398
- */
399
- if ( api.customizeSave ) {
400
- api.customizeSave = false;
401
- api.ajax('wpglobus_customize_save');
402
- }
403
- });
404
- }
405
- };
406
-
407
- WPGlobusCustomizeOptions = $.extend( {}, WPGlobusCustomizeOptions, api );
408
-
409
- WPGlobusCustomizeOptions.init();
410
-
411
  });
1
+ /**
2
+ * WPGlobus Customize Options
3
+ * Interface JS functions
4
+ *
5
+ * @since 1.4.6
6
+ *
7
+ * @package WPGlobus
8
+ * @subpackage Customize Options
9
+ */
10
+ /*jslint browser: true*/
11
+ /*global jQuery, console, WPGlobusCore, WPGlobusCoreData, WPGlobusCustomizeOptions*/
12
+ jQuery(document).ready(function ($) {
13
+ "use strict";
14
+
15
+ var api = {
16
+ listID: '#wpglobus-sortable',
17
+ customizeSave: false,
18
+ customizeSaveData: '',
19
+ init: function() {
20
+ $( '#wpglobus-sortable' ).sortable({
21
+ update: api.sortUpdate
22
+ });
23
+ api.setJSCodeSection();
24
+ api.addListeners();
25
+ api.ajaxListener();
26
+ },
27
+ setJSCodeSection: function() {
28
+ var el = WPGlobusCustomizeOptions.settings['wpglobus_js_editor_section'];
29
+ if ( 'undefined' === typeof el ) {
30
+ return;
31
+ }
32
+ if ( 'undefined' === typeof el['wpglobus_customize_js_editor'] ) {
33
+ return
34
+ }
35
+ $('#customize-control-wpglobus_customize_js_editor .customize-control-title')
36
+ .css({'width':'50%'})
37
+ .after('<span class="wpglobus-customize-js-editor-expand" style="float:right;"><a href="#">'+WPGlobusCustomizeOptions.i18n['expandShrink']+'</a></span>');
38
+
39
+ /**
40
+ * Expand/Shrink editor.
41
+ */
42
+ $(document).on('click', '.wpglobus-customize-js-editor-expand', function(ev){
43
+ var $t = $(this),
44
+ $f = $('#customize-controls');
45
+ $t.toggleClass('expanded');
46
+ if ( $t.hasClass('expanded') ) {
47
+ $f.css({'width':'500px'});
48
+ } else {
49
+ $f.css({'width':''});
50
+ }
51
+ });
52
+
53
+ /**
54
+ * Set defaults.
55
+ */
56
+ $('#sub-accordion-section-wpglobus_js_editor_section .customize-section-back').on('click', function(ev){
57
+ $('#customize-controls').css({'width':''});
58
+ $('.wpglobus-customize-js-editor-expand').removeClass('expanded');
59
+ });
60
+
61
+ },
62
+ addListeners: function() {
63
+
64
+ $( 'body' ).on( 'change', '.wpglobus-listen-change', function(ev){
65
+ api.setState( false );
66
+ });
67
+
68
+ $( 'body' ).on( 'change', '#wpglobus-sortable input.wpglobus-language-item', function(ev){
69
+ var $t = $( this );
70
+ if ( ! $t.prop( 'checked' ) ) {
71
+ api.removeLanguage( $t );
72
+ }
73
+ });
74
+
75
+ $( '#customize-control-wpglobus_add_languages_select_box select' ).on(
76
+ 'change',
77
+ function(event){
78
+ api.addLanguage( event, this );
79
+ }
80
+ );
81
+
82
+ /** open Addons page in new tab */
83
+ $( '#accordion-section-' + WPGlobusCustomizeOptions.sections.wpglobus_addons_section + ' .accordion-section-title' ).off( 'click keydown' );
84
+ $( 'body' ).on(
85
+ 'click',
86
+ '#accordion-section-' + WPGlobusCustomizeOptions.sections.wpglobus_addons_section + ' .accordion-section-title',
87
+ function(ev) {
88
+ window.open( WPGlobusCustomizeOptions.addonsPage, '_blank' );
89
+ }
90
+ );
91
+
92
+ /** Save Fields Control settings & Reload customize page */
93
+ $( document ).on( 'click', '#' + WPGlobusCustomizeOptions.userControlSaveButton, function(){ api.userControlAjax( this ) } );
94
+
95
+ /**
96
+ * Init for wpglobus_js_editor_section.
97
+ * @since 1.9.7
98
+ */
99
+ $(document).on(
100
+ 'click',
101
+ '#accordion-section-' + WPGlobusCustomizeOptions.sections.wpglobus_js_editor_section + ' .accordion-section-title',
102
+ function(ev) {
103
+ /**
104
+ * Fix Code Editor height.
105
+ */
106
+ $('#customize-control-wpglobus_customize_js_editor .CodeMirror').css({'height':'40em'});
107
+ }
108
+ );
109
+ },
110
+ removeLanguage: function( t ) {
111
+ var l = t.data( 'language' ),
112
+ e = $( '#customize-control-wpglobus_add_languages_select_box select option' ).eq(0);
113
+ $( '<option value="'+l+'">' +
114
+ WPGlobusCustomizeOptions.config.language_name[l] + ' (' + WPGlobusCustomizeOptions.config.en_language_name[l] + ') ' +
115
+ '</option>' ).insertAfter( e );
116
+ t.parent('li').remove();
117
+ },
118
+ addLanguage: function( event, t ) {
119
+ var code = $(t).attr( 'value' ),
120
+ s = $( '#wpglobus-item-skeleton' ).html(),
121
+ item = '',
122
+ li_class = $( api.listID + ' li').attr( 'class' );
123
+
124
+ if ( code == 'select' ) return;
125
+
126
+ item = s.replace(
127
+ '{{flag}}',
128
+ 'src="' +WPGlobusCustomizeOptions.config.flags_url + WPGlobusCustomizeOptions.config.flag[code] + '"'
129
+ );
130
+ item = item.replace( '{{name}}', code );
131
+ item = item.replace( '{{id}}', code );
132
+ item = item.replace( 'checked="{{checked}}"', 'checked="checked"' );
133
+ item = item.replace( 'disabled="{{disabled}}"', '' );
134
+ item = item.replace( '{{item}}', WPGlobusCustomizeOptions.config.en_language_name[ code ] + ' (' +code+ ') ' );
135
+ item = item.replace( '{{order}}', '#' );
136
+ item = item.replace( '{{language}}', code );
137
+ item = item.replace( '{{edit-link}}', WPGlobusCustomizeOptions.editLink.replace( '{{language}}', code ) );
138
+ $( '<li class="' + li_class + '">' + item + '</li>' ).appendTo( api.listID );
139
+ api.setOrder();
140
+
141
+ var opts = $(t).find( 'option' );
142
+ $.each( opts, function(i, e) {
143
+ if ( $(e).attr('value') == code ) {
144
+ $(e).remove();
145
+ }
146
+ });
147
+
148
+ },
149
+ sortUpdate: function( event, ui ) {
150
+ api.setState( false );
151
+ api.setOrder();
152
+ },
153
+ setOrder: function() {
154
+
155
+ $( '#wpglobus-sortable input.wpglobus-language-item' ).each( function( i, e ){
156
+ var $e = $(e);
157
+ if ( i == 0 ) {
158
+ $e.prop( 'disabled', 'disabled' ).prop( 'checked', 'checked' );
159
+ } else {
160
+ $e.removeProp( 'disabled' );
161
+ }
162
+ $e.data( 'order', i );
163
+ } );
164
+
165
+ },
166
+ setState: function( state ) {
167
+ wp.customize.state( 'saved' ).set( state );
168
+ },
169
+ getCustomizeSaveData: function() {
170
+ return api.customizeSaveData;
171
+ },
172
+ enabledUserControl: function(setting) {
173
+ if ( 'undefined' === typeof WPGlobusCustomize.controlInstances[setting] ) {
174
+ return false;
175
+ }
176
+ return WPGlobusCustomize.controlInstances[setting].userControl.enabled;
177
+ },
178
+ userControlAjax: function( btn ) {
179
+
180
+ $( btn ).prop( 'disabled', true );
181
+
182
+ var order = {};
183
+ order[ 'action' ] = 'cb-controls-save';
184
+ order[ 'controls' ] = {};
185
+ $( '.wpglobus-customize-cb-control' ).each( function(i, cb){
186
+ var $t = $( cb );
187
+ if ( $t.prop( 'checked' ) ) {
188
+ // do nothing
189
+ } else {
190
+ var ctrl = $t.data( 'control' );
191
+ ctrl = ctrl.replace( '[', '{{');
192
+ ctrl = ctrl.replace( ']', '}}');
193
+ order[ 'controls' ][ ctrl ] = 'disable';
194
+ }
195
+ });
196
+
197
+ $.ajax({
198
+ beforeSend:function(){},
199
+ type: 'POST',
200
+ url: WPGlobusCustomizeOptions.ajaxurl,
201
+ data: { action:WPGlobusCustomizeOptions.process_ajax, order:order },
202
+ dataType: 'json'
203
+ })
204
+ .always(function() {
205
+ location.reload(true);
206
+ });
207
+
208
+ },
209
+ ajax: function(ajaxAction, data) {
210
+
211
+ if ( 'wpglobus_customize_save' == ajaxAction ) {
212
+
213
+ var order = {};
214
+ order['action'] = 'wpglobus_customize_save';
215
+ order['options'] = {};
216
+
217
+ $.each( WPGlobusCustomizeOptions.settings, function( section, el ) {
218
+
219
+ $.each( el, function( id, obj ) {
220
+
221
+ if ( id == 'wpglobus_customize_enabled_languages' ) {
222
+
223
+ order[ 'options' ][ obj.option ] = {};
224
+ $( '#wpglobus-sortable input.wpglobus-language-item' ).each( function( i, e ) {
225
+ order[ 'options' ][ obj.option ][ $(this).data('language') ] = '1';
226
+ });
227
+
228
+ return true;
229
+ }
230
+
231
+ if ( -1 != api.customizeSaveData.indexOf( 'wpglobus_customize_post_type_' ) &&
232
+ -1 != id.indexOf( 'wpglobus_customize_post_type_' ) ) {
233
+
234
+ if ( typeof order[ 'options' ][ obj.option ] === 'undefined' ) {
235
+ order[ 'options' ][ obj.option ] = {};
236
+ }
237
+ order[ 'options' ][ obj.option ][ id.replace( 'wpglobus_customize_post_type_', '' ) ] =
238
+ $( '#customize-control-' + id + ' input' ).prop( 'checked' ) ? 1 : 0;
239
+
240
+ } else {
241
+
242
+ if ( -1 != api.customizeSaveData.indexOf( id ) ) {
243
+
244
+ var s = $( '#customize-control-' + id + ' ' + obj.type ),
245
+ val = '';
246
+
247
+ if ( 'textarea' == obj.type ) {
248
+ val = s.val();
249
+ } else if ( 'wpglobus_checkbox' == obj.type ) {
250
+ s = $( '#customize-control-' + id + ' input' );
251
+ if ( id == 'wpglobus_customize_selector_wp_list_pages' ) {
252
+ val = s.prop( 'checked' ) ? 1 : 0;
253
+ } else {
254
+ val = s.prop( 'checked' ) ? 1 : '';
255
+ }
256
+ } else if ( 'checkbox' == obj.type ) {
257
+ val = s.prop( 'checked' ) ? 1 : '';
258
+ } else if ( 'select' == obj.type ) {
259
+ val = s.val();
260
+ } else if ( 'code_editor' == obj.type ) {
261
+ var control = wp.customize.control.instance(id);
262
+ if ( 'undefined' !== typeof control ) {
263
+ val = control.setting();
264
+ }
265
+ }
266
+ order['options'][obj.option] = val;
267
+
268
+ if ( 'code_editor' == obj.type ) {
269
+ if ( 'undefined' === typeof control ) {
270
+ /**
271
+ * If control is undefined then we don't need to save code.
272
+ */
273
+ delete order['options'][obj.option];
274
+ }
275
+ }
276
+ }
277
+ }
278
+
279
+ });
280
+
281
+ });
282
+
283
+ }
284
+
285
+ $.ajax({
286
+ beforeSend:function(){},
287
+ type: 'POST',
288
+ url: WPGlobusCustomizeOptions.ajaxurl,
289
+ data: { action:WPGlobusCustomizeOptions.process_ajax, order:order },
290
+ dataType: 'json'
291
+ });
292
+ },
293
+ getChangesetData: function(ajaxData) {
294
+ /**
295
+ * @since 1.7.9
296
+ */
297
+ if ( 'undefined' !== typeof ajaxData ) {
298
+
299
+ var changesetData = /customize_changeset_data=([^&]+)/.exec(ajaxData);
300
+
301
+ if ( 'undefined' === typeof changesetData[1] ) {
302
+ return;
303
+ }
304
+
305
+ var settingsJson = decodeURIComponent( changesetData[1] );
306
+ var settings = JSON.parse(settingsJson);
307
+ var values, value;
308
+
309
+ $.each( settings, function(setting, data) {
310
+
311
+ if ( 'undefined' !== typeof WPGlobusCustomize.controlInstances[setting] ) {
312
+
313
+ value = '';
314
+ if ( 'link' == WPGlobusCustomize.controlInstances[setting]['type'] ) {
315
+ if ( 1 ) {
316
+ /**
317
+ * In "customize changeset" post we must save URL with ||| delimiters
318
+ * otherwise we lost value after validating "$setting->validate( $value )"
319
+ * @see function post_value() in wp-includes\class-wp-customize-manager.php
320
+ */
321
+ value = WPGlobusCustomize.controlInstances[setting].setting;
322
+ } else {
323
+ /**
324
+ * Using standard language marks {:en}url{:}.
325
+ * This is correct code and approach but need to find ability to prevent validating.
326
+ * @see upper comment.
327
+ */
328
+ values = WPGlobusCustomize.getTranslations( WPGlobusCustomize.controlInstances[setting].setting );
329
+ /**
330
+ * @todo make function to get string with language marks from object.
331
+ */
332
+ $.each(WPGlobusCoreData.enabled_languages, function(i,l){
333
+ if ( '' != values[l] && 'undefined' !== typeof values[l] ) {
334
+ value = value + WPGlobusCore.addLocaleMarks(values[l], l);
335
+ }
336
+ });
337
+ }
338
+ } else {
339
+
340
+ value = WPGlobusCustomize.controlInstances[setting].setting;
341
+
342
+ }
343
+ settings[setting]['value'] = value;
344
+ }
345
+ });
346
+
347
+ var newChangeset = JSON.stringify(settings);
348
+ newChangeset = encodeURIComponent(newChangeset);
349
+ newChangeset = newChangeset.replace( /%20/g, '+' );
350
+
351
+ ajaxData = ajaxData.replace( changesetData[1], newChangeset );
352
+
353
+ }
354
+
355
+ return ajaxData;
356
+ },
357
+ ajaxListener: function() {
358
+ /**
359
+ * ajaxSend event handler
360
+ */
361
+ $( document ).on( 'ajaxSend', function( ev, jqXHR, ajaxOptions ) {
362
+ if ( typeof ajaxOptions.data === 'undefined' ) {
363
+ return;
364
+ }
365
+
366
+ if ( -1 != ajaxOptions.data.indexOf('wp_customize=on') && -1 != ajaxOptions.data.indexOf('action=customize_save') ) {
367
+
368
+ if ( -1 != ajaxOptions.data.indexOf('customized=') ) {
369
+ api.customizeSave = true;
370
+ api.customizeSaveData = ajaxOptions.data;
371
+ } else if ( -1 != ajaxOptions.data.indexOf('customize_changeset_data=') ) {
372
+ /**
373
+ * Ajax action when are saved changeset.
374
+ *
375
+ * @since 1.7.9
376
+ */
377
+ ajaxOptions.data = api.getChangesetData(ajaxOptions.data);
378
+ }
379
+
380
+ }
381
+ });
382
+
383
+ $( document ).on( 'ajaxComplete', function( ev, response, ajaxOptions ) {
384
+ if ( typeof response.responseText === 'undefined' ) {
385
+ return;
386
+ }
387
+ if ( api.customizeSave ) {
388
+ api.customizeSave = false;
389
+ api.ajax('wpglobus_customize_save');
390
+ }
391
+ });
392
+
393
+ $( document ).on( 'ajaxStop', function() {
394
+ /**
395
+ * We need to use ajaxStop (together with ajaxComplete) event to make save options in Customizer
396
+ * cause is Redux Framework makes unbind ajaxComplete event
397
+ * @see https://github.com/reduxframework/redux-framework/issues/2896
398
+ */
399
+ if ( api.customizeSave ) {
400
+ api.customizeSave = false;
401
+ api.ajax('wpglobus_customize_save');
402
+ }
403
+ });
404
+ }
405
+ };
406
+
407
+ WPGlobusCustomizeOptions = $.extend( {}, WPGlobusCustomizeOptions, api );
408
+
409
+ WPGlobusCustomizeOptions.init();
410
+
411
  });
includes/js/wpglobus-customize-options.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){"use strict";var o={listID:"#wpglobus-sortable",customizeSave:!1,customizeSaveData:"",init:function(){e("#wpglobus-sortable").sortable({update:o.sortUpdate}),o.setJSCodeSection(),o.addListeners(),o.ajaxListener()},setJSCodeSection:function(){var o=WPGlobusCustomizeOptions.settings.wpglobus_js_editor_section;void 0!==o&&void 0!==o.wpglobus_customize_js_editor&&(e("#customize-control-wpglobus_customize_js_editor .customize-control-title").css({width:"50%"}).after('<span class="wpglobus-customize-js-editor-expand" style="float:right;"><a href="#">'+WPGlobusCustomizeOptions.i18n.expandShrink+"</a></span>"),e(document).on("click",".wpglobus-customize-js-editor-expand",function(o){var t=e(this),s=e("#customize-controls");t.toggleClass("expanded"),t.hasClass("expanded")?s.css({width:"500px"}):s.css({width:""})}),e("#sub-accordion-section-wpglobus_js_editor_section .customize-section-back").on("click",function(o){e("#customize-controls").css({width:""}),e(".wpglobus-customize-js-editor-expand").removeClass("expanded")}))},addListeners:function(){e("body").on("change",".wpglobus-listen-change",function(e){o.setState(!1)}),e("body").on("change","#wpglobus-sortable input.wpglobus-language-item",function(t){var s=e(this);s.prop("checked")||o.removeLanguage(s)}),e("#customize-control-wpglobus_add_languages_select_box select").on("change",function(e){o.addLanguage(e,this)}),e("#accordion-section-"+WPGlobusCustomizeOptions.sections.wpglobus_addons_section+" .accordion-section-title").off("click keydown"),e("body").on("click","#accordion-section-"+WPGlobusCustomizeOptions.sections.wpglobus_addons_section+" .accordion-section-title",function(e){window.open(WPGlobusCustomizeOptions.addonsPage,"_blank")}),e(document).on("click","#"+WPGlobusCustomizeOptions.userControlSaveButton,function(){o.userControlAjax(this)}),e(document).on("click","#accordion-section-"+WPGlobusCustomizeOptions.sections.wpglobus_js_editor_section+" .accordion-section-title",function(o){e("#customize-control-wpglobus_customize_js_editor .CodeMirror").css({height:"40em"})})},removeLanguage:function(o){var t=o.data("language"),s=e("#customize-control-wpglobus_add_languages_select_box select option").eq(0);e('<option value="'+t+'">'+WPGlobusCustomizeOptions.config.language_name[t]+" ("+WPGlobusCustomizeOptions.config.en_language_name[t]+") </option>").insertAfter(s),o.parent("li").remove()},addLanguage:function(t,s){var n=e(s).attr("value"),i=e("#wpglobus-item-skeleton").html(),a="",c=e(o.listID+" li").attr("class");if("select"!=n){a=(a=(a=(a=(a=(a=(a=(a=(a=i.replace("{{flag}}",'src="'+WPGlobusCustomizeOptions.config.flags_url+WPGlobusCustomizeOptions.config.flag[n]+'"')).replace("{{name}}",n)).replace("{{id}}",n)).replace('checked="{{checked}}"','checked="checked"')).replace('disabled="{{disabled}}"',"")).replace("{{item}}",WPGlobusCustomizeOptions.config.en_language_name[n]+" ("+n+") ")).replace("{{order}}","#")).replace("{{language}}",n)).replace("{{edit-link}}",WPGlobusCustomizeOptions.editLink.replace("{{language}}",n)),e('<li class="'+c+'">'+a+"</li>").appendTo(o.listID),o.setOrder();var u=e(s).find("option");e.each(u,function(o,t){e(t).attr("value")==n&&e(t).remove()})}},sortUpdate:function(e,t){o.setState(!1),o.setOrder()},setOrder:function(){e("#wpglobus-sortable input.wpglobus-language-item").each(function(o,t){var s=e(t);0==o?s.prop("disabled","disabled").prop("checked","checked"):s.removeProp("disabled"),s.data("order",o)})},setState:function(e){wp.customize.state("saved").set(e)},getCustomizeSaveData:function(){return o.customizeSaveData},enabledUserControl:function(e){return void 0!==WPGlobusCustomize.controlInstances[e]&&WPGlobusCustomize.controlInstances[e].userControl.enabled},userControlAjax:function(o){e(o).prop("disabled",!0);var t={};t.action="cb-controls-save",t.controls={},e(".wpglobus-customize-cb-control").each(function(o,s){var n=e(s);if(n.prop("checked"));else{var i=n.data("control");i=(i=i.replace("[","{{")).replace("]","}}"),t.controls[i]="disable"}}),e.ajax({beforeSend:function(){},type:"POST",url:WPGlobusCustomizeOptions.ajaxurl,data:{action:WPGlobusCustomizeOptions.process_ajax,order:t},dataType:"json"}).always(function(){location.reload(!0)})},ajax:function(t,s){if("wpglobus_customize_save"==t){var n={};n.action="wpglobus_customize_save",n.options={},e.each(WPGlobusCustomizeOptions.settings,function(t,s){e.each(s,function(t,s){if("wpglobus_customize_enabled_languages"==t)return n.options[s.option]={},e("#wpglobus-sortable input.wpglobus-language-item").each(function(o,t){n.options[s.option][e(this).data("language")]="1"}),!0;if(-1!=o.customizeSaveData.indexOf("wpglobus_customize_post_type_")&&-1!=t.indexOf("wpglobus_customize_post_type_"))void 0===n.options[s.option]&&(n.options[s.option]={}),n.options[s.option][t.replace("wpglobus_customize_post_type_","")]=e("#customize-control-"+t+" input").prop("checked")?1:0;else if(-1!=o.customizeSaveData.indexOf(t)){var i=e("#customize-control-"+t+" "+s.type),a="";if("textarea"==s.type)a=i.val();else if("wpglobus_checkbox"==s.type)i=e("#customize-control-"+t+" input"),a="wpglobus_customize_selector_wp_list_pages"==t?i.prop("checked")?1:0:i.prop("checked")?1:"";else if("checkbox"==s.type)a=i.prop("checked")?1:"";else if("select"==s.type)a=i.val();else if("code_editor"==s.type){var c=wp.customize.control.instance(t);void 0!==c&&(a=c.setting())}n.options[s.option]=a,"code_editor"==s.type&&void 0===c&&delete n.options[s.option]}})})}e.ajax({beforeSend:function(){},type:"POST",url:WPGlobusCustomizeOptions.ajaxurl,data:{action:WPGlobusCustomizeOptions.process_ajax,order:n},dataType:"json"})},getChangesetData:function(o){if(void 0!==o){var t=/customize_changeset_data=([^&]+)/.exec(o);if(void 0===t[1])return;var s,n=decodeURIComponent(t[1]),i=JSON.parse(n);e.each(i,function(e,o){void 0!==WPGlobusCustomize.controlInstances[e]&&(s="",s=(WPGlobusCustomize.controlInstances[e].type,WPGlobusCustomize.controlInstances[e].setting),i[e].value=s)});var a=JSON.stringify(i);a=(a=encodeURIComponent(a)).replace(/%20/g,"+"),o=o.replace(t[1],a)}return o},ajaxListener:function(){e(document).on("ajaxSend",function(e,t,s){void 0!==s.data&&-1!=s.data.indexOf("wp_customize=on")&&-1!=s.data.indexOf("action=customize_save")&&(-1!=s.data.indexOf("customized=")?(o.customizeSave=!0,o.customizeSaveData=s.data):-1!=s.data.indexOf("customize_changeset_data=")&&(s.data=o.getChangesetData(s.data)))}),e(document).on("ajaxComplete",function(e,t,s){void 0!==t.responseText&&o.customizeSave&&(o.customizeSave=!1,o.ajax("wpglobus_customize_save"))}),e(document).on("ajaxStop",function(){o.customizeSave&&(o.customizeSave=!1,o.ajax("wpglobus_customize_save"))})}};WPGlobusCustomizeOptions=e.extend({},WPGlobusCustomizeOptions,o),WPGlobusCustomizeOptions.init()});
1
+ jQuery(document).ready(function(c){"use strict";var u={listID:"#wpglobus-sortable",customizeSave:!1,customizeSaveData:"",init:function(){c("#wpglobus-sortable").sortable({update:u.sortUpdate}),u.setJSCodeSection(),u.addListeners(),u.ajaxListener()},setJSCodeSection:function(){var e=WPGlobusCustomizeOptions.settings.wpglobus_js_editor_section;void 0!==e&&void 0!==e.wpglobus_customize_js_editor&&(c("#customize-control-wpglobus_customize_js_editor .customize-control-title").css({width:"50%"}).after('<span class="wpglobus-customize-js-editor-expand" style="float:right;"><a href="#">'+WPGlobusCustomizeOptions.i18n.expandShrink+"</a></span>"),c(document).on("click",".wpglobus-customize-js-editor-expand",function(e){var o=c(this),t=c("#customize-controls");o.toggleClass("expanded"),o.hasClass("expanded")?t.css({width:"500px"}):t.css({width:""})}),c("#sub-accordion-section-wpglobus_js_editor_section .customize-section-back").on("click",function(e){c("#customize-controls").css({width:""}),c(".wpglobus-customize-js-editor-expand").removeClass("expanded")}))},addListeners:function(){c("body").on("change",".wpglobus-listen-change",function(e){u.setState(!1)}),c("body").on("change","#wpglobus-sortable input.wpglobus-language-item",function(e){var o=c(this);o.prop("checked")||u.removeLanguage(o)}),c("#customize-control-wpglobus_add_languages_select_box select").on("change",function(e){u.addLanguage(e,this)}),c("#accordion-section-"+WPGlobusCustomizeOptions.sections.wpglobus_addons_section+" .accordion-section-title").off("click keydown"),c("body").on("click","#accordion-section-"+WPGlobusCustomizeOptions.sections.wpglobus_addons_section+" .accordion-section-title",function(e){window.open(WPGlobusCustomizeOptions.addonsPage,"_blank")}),c(document).on("click","#"+WPGlobusCustomizeOptions.userControlSaveButton,function(){u.userControlAjax(this)}),c(document).on("click","#accordion-section-"+WPGlobusCustomizeOptions.sections.wpglobus_js_editor_section+" .accordion-section-title",function(e){c("#customize-control-wpglobus_customize_js_editor .CodeMirror").css({height:"40em"})})},removeLanguage:function(e){var o=e.data("language"),t=c("#customize-control-wpglobus_add_languages_select_box select option").eq(0);c('<option value="'+o+'">'+WPGlobusCustomizeOptions.config.language_name[o]+" ("+WPGlobusCustomizeOptions.config.en_language_name[o]+") </option>").insertAfter(t),e.parent("li").remove()},addLanguage:function(e,o){var t=c(o).attr("value"),s=c("#wpglobus-item-skeleton").html(),n="",i=c(u.listID+" li").attr("class");if("select"!=t){n=(n=(n=(n=(n=(n=(n=(n=(n=s.replace("{{flag}}",'src="'+WPGlobusCustomizeOptions.config.flags_url+WPGlobusCustomizeOptions.config.flag[t]+'"')).replace("{{name}}",t)).replace("{{id}}",t)).replace('checked="{{checked}}"','checked="checked"')).replace('disabled="{{disabled}}"',"")).replace("{{item}}",WPGlobusCustomizeOptions.config.en_language_name[t]+" ("+t+") ")).replace("{{order}}","#")).replace("{{language}}",t)).replace("{{edit-link}}",WPGlobusCustomizeOptions.editLink.replace("{{language}}",t)),c('<li class="'+i+'">'+n+"</li>").appendTo(u.listID),u.setOrder();var a=c(o).find("option");c.each(a,function(e,o){c(o).attr("value")==t&&c(o).remove()})}},sortUpdate:function(e,o){u.setState(!1),u.setOrder()},setOrder:function(){c("#wpglobus-sortable input.wpglobus-language-item").each(function(e,o){var t=c(o);0==e?t.prop("disabled","disabled").prop("checked","checked"):t.removeProp("disabled"),t.data("order",e)})},setState:function(e){wp.customize.state("saved").set(e)},getCustomizeSaveData:function(){return u.customizeSaveData},enabledUserControl:function(e){return void 0!==WPGlobusCustomize.controlInstances[e]&&WPGlobusCustomize.controlInstances[e].userControl.enabled},userControlAjax:function(e){c(e).prop("disabled",!0);var n={action:"cb-controls-save",controls:{}};c(".wpglobus-customize-cb-control").each(function(e,o){var t=c(o);if(t.prop("checked"));else{var s=t.data("control");s=(s=s.replace("[","{{")).replace("]","}}"),n.controls[s]="disable"}}),c.ajax({beforeSend:function(){},type:"POST",url:WPGlobusCustomizeOptions.ajaxurl,data:{action:WPGlobusCustomizeOptions.process_ajax,order:n},dataType:"json"}).always(function(){location.reload(!0)})},ajax:function(e,o){if("wpglobus_customize_save"==e){var i={action:"wpglobus_customize_save",options:{}};c.each(WPGlobusCustomizeOptions.settings,function(e,o){c.each(o,function(e,t){if("wpglobus_customize_enabled_languages"==e)return i.options[t.option]={},c("#wpglobus-sortable input.wpglobus-language-item").each(function(e,o){i.options[t.option][c(this).data("language")]="1"}),!0;if(-1!=u.customizeSaveData.indexOf("wpglobus_customize_post_type_")&&-1!=e.indexOf("wpglobus_customize_post_type_"))void 0===i.options[t.option]&&(i.options[t.option]={}),i.options[t.option][e.replace("wpglobus_customize_post_type_","")]=c("#customize-control-"+e+" input").prop("checked")?1:0;else if(-1!=u.customizeSaveData.indexOf(e)){var o=c("#customize-control-"+e+" "+t.type),s="";if("textarea"==t.type)s=o.val();else if("wpglobus_checkbox"==t.type)o=c("#customize-control-"+e+" input"),s="wpglobus_customize_selector_wp_list_pages"==e?o.prop("checked")?1:0:o.prop("checked")?1:"";else if("checkbox"==t.type)s=o.prop("checked")?1:"";else if("select"==t.type)s=o.val();else if("code_editor"==t.type){var n=wp.customize.control.instance(e);void 0!==n&&(s=n.setting())}i.options[t.option]=s,"code_editor"==t.type&&void 0===n&&delete i.options[t.option]}})})}c.ajax({beforeSend:function(){},type:"POST",url:WPGlobusCustomizeOptions.ajaxurl,data:{action:WPGlobusCustomizeOptions.process_ajax,order:i},dataType:"json"})},getChangesetData:function(e){if(void 0!==e){var o=/customize_changeset_data=([^&]+)/.exec(e);if(void 0===o[1])return;var t,s=decodeURIComponent(o[1]),n=JSON.parse(s);c.each(n,function(e,o){void 0!==WPGlobusCustomize.controlInstances[e]&&(t="",t=(WPGlobusCustomize.controlInstances[e].type,WPGlobusCustomize.controlInstances[e].setting),n[e].value=t)});var i=JSON.stringify(n);i=(i=encodeURIComponent(i)).replace(/%20/g,"+"),e=e.replace(o[1],i)}return e},ajaxListener:function(){c(document).on("ajaxSend",function(e,o,t){void 0!==t.data&&-1!=t.data.indexOf("wp_customize=on")&&-1!=t.data.indexOf("action=customize_save")&&(-1!=t.data.indexOf("customized=")?(u.customizeSave=!0,u.customizeSaveData=t.data):-1!=t.data.indexOf("customize_changeset_data=")&&(t.data=u.getChangesetData(t.data)))}),c(document).on("ajaxComplete",function(e,o,t){void 0!==o.responseText&&u.customizeSave&&(u.customizeSave=!1,u.ajax("wpglobus_customize_save"))}),c(document).on("ajaxStop",function(){u.customizeSave&&(u.customizeSave=!1,u.ajax("wpglobus_customize_save"))})}};WPGlobusCustomizeOptions=c.extend({},WPGlobusCustomizeOptions,u),WPGlobusCustomizeOptions.init()});
includes/js/wpglobus-customize-preview.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(t){wp.customize("wpglobus_blogname",function(i){i.bind(function(i){t(".site-title a, #site-title a").html(i),t("a.site-title").html(i)})}),wp.customize("wpglobus_blogdescription",function(i){i.bind(function(i){t(".site-description, #site-description").html(i)})}),setTimeout(function(){t(".site-title a, #site-title a").html(WPGlobusCustomize.blogname),t(".site-description, #site-description").html(WPGlobusCustomize.blogdescription),t("a.site-title").html(WPGlobusCustomize.blogname)},500)});
1
+ jQuery(document).ready(function(i){wp.customize("wpglobus_blogname",function(t){t.bind(function(t){i(".site-title a, #site-title a").html(t),i("a.site-title").html(t)})}),wp.customize("wpglobus_blogdescription",function(t){t.bind(function(t){i(".site-description, #site-description").html(t)})}),setTimeout(function(){i(".site-title a, #site-title a").html(WPGlobusCustomize.blogname),i(".site-description, #site-description").html(WPGlobusCustomize.blogdescription),i("a.site-title").html(WPGlobusCustomize.blogname)},500)});
includes/js/wpglobus-form.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(a){"use strict";var e=/^[a-z]{2}$/,s=a("#wpglobus_language_code"),u=a("#wpglobus_language_name"),o=a("#wpglobus_en_language_name"),r=a([]).add(s).add(u).add(o);a("#wpglobus_edit_form").on("submit",function(a){var u=!0;r.removeClass("wpglobus-state-error");var o,t;(u=u&&(o=s,t=e,!!t.test(o.val())||(o.addClass("wpglobus-state-error"),!1)))||a.preventDefault()})});
1
+ jQuery(document).ready(function(a){"use strict";var u=/^[a-z]{2}$/,o=a("#wpglobus_language_code"),e=a("#wpglobus_language_name"),s=a("#wpglobus_en_language_name"),t=a([]).add(o).add(e).add(s);a("#wpglobus_edit_form").on("submit",function(a){var e,s=!0;t.removeClass("wpglobus-state-error"),(s=s&&(!!u.test((e=o).val())||(e.addClass("wpglobus-state-error"),!1)))||a.preventDefault()})});
includes/js/wpglobus-media-post-php.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){"use strict";t(document).on("wpglobus_after_post_edit",function(n){t(document).ajaxSend(function(t,n,a){void 0!==a.data&&"undefined"!=typeof WPGlobusAdmin&&-1!=a.data.indexOf("action=send-attachment-to-editor")&&(a.data=a.data+"&wpglobusLanguageTab="+WPGlobusAdmin.currentTab)})})}(jQuery);
1
+ !function(n){"use strict";n(document).on("wpglobus_after_post_edit",function(t){n(document).ajaxSend(function(t,n,a){void 0!==a.data&&"undefined"!=typeof WPGlobusAdmin&&-1!=a.data.indexOf("action=send-attachment-to-editor")&&(a.data=a.data+"&wpglobusLanguageTab="+WPGlobusAdmin.currentTab)})})}(jQuery);
includes/js/wpglobus-media.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){"use strict";if("undefined"!=typeof WPGlobusCore&&"undefined"!=typeof WPGlobusMedia){var e={content:{},save:!0,resetContent:!0,init:function(n){var a=t(".wpglobus-post-body-tabs");1==a.length&&(a.insertBefore(".wp_attachment_details"),a.tabs(),e.iniSet(),e.setContent(),e.attachListeners())},iniSet:function(){t.each(WPGlobusMedia.attachment,function(n,a){e.content[a]=t("#"+a).val(),t("#"+a).addClass("wpglobus-translatable")})},setContent:function(n){void 0===n&&(n=!1),n?t.each(WPGlobusMedia.attachment,function(n,a){t("#"+a).val(e.content[a])}):t.each(WPGlobusMedia.attachment,function(n,a){t("#"+a).val(WPGlobusCore.TextFilter(e.content[a],WPGlobusMedia.language,"RETURN_EMPTY"))})},attachListeners:function(){t(document).on("tabsactivate",".wpglobus-post-body-tabs",function(t,n){WPGlobusMedia.language=n.newTab[0].dataset.language,e.setContent()}),t.each(WPGlobusMedia.attachment,function(n,a){t(document).on("keyup","#"+a,function(t){e.content[t.currentTarget.id]=WPGlobusCore.getString(e.content[t.currentTarget.id],t.currentTarget.value,WPGlobusMedia.language)})}),t(document).on("mouseenter","#publish",function(t){e.setContent(e.save)}).on("mouseleave","#publish",function(t){e.resetContent&&e.setContent(),e.resetContent=!0}).on("click","#publish",function(t){e.resetContent=!1}),t(document).ajaxSend(function(t,e,n){void 0!==n.data&&-1!=n.data.indexOf("action=send-attachment-to-editor")&&(n.data=n.data+"&wpglobusLanguageTab="+WPGlobusAdmin.currentTab)})}};WPGlobusMedia=t.extend({},WPGlobusMedia,e),WPGlobusMedia.init()}}(jQuery);
1
+ !function(n){"use strict";if("undefined"!=typeof WPGlobusCore&&"undefined"!=typeof WPGlobusMedia){var a={content:{},save:!0,resetContent:!0,init:function(t){var e=n(".wpglobus-post-body-tabs");1==e.length&&(e.insertBefore(".wp_attachment_details"),e.tabs(),a.iniSet(),a.setContent(),a.attachListeners())},iniSet:function(){n.each(WPGlobusMedia.attachment,function(t,e){a.content[e]=n("#"+e).val(),n("#"+e).addClass("wpglobus-translatable")})},setContent:function(t){void 0===t&&(t=!1),t?n.each(WPGlobusMedia.attachment,function(t,e){n("#"+e).val(a.content[e])}):n.each(WPGlobusMedia.attachment,function(t,e){n("#"+e).val(WPGlobusCore.TextFilter(a.content[e],WPGlobusMedia.language,"RETURN_EMPTY"))})},attachListeners:function(){n(document).on("tabsactivate",".wpglobus-post-body-tabs",function(t,e){WPGlobusMedia.language=e.newTab[0].dataset.language,a.setContent()}),n.each(WPGlobusMedia.attachment,function(t,e){n(document).on("keyup","#"+e,function(t){a.content[t.currentTarget.id]=WPGlobusCore.getString(a.content[t.currentTarget.id],t.currentTarget.value,WPGlobusMedia.language)})}),n(document).on("mouseenter","#publish",function(t){a.setContent(a.save)}).on("mouseleave","#publish",function(t){a.resetContent&&a.setContent(),a.resetContent=!0}).on("click","#publish",function(t){a.resetContent=!1}),n(document).ajaxSend(function(t,e,n){void 0!==n.data&&-1!=n.data.indexOf("action=send-attachment-to-editor")&&(n.data=n.data+"&wpglobusLanguageTab="+WPGlobusAdmin.currentTab)})}};WPGlobusMedia=n.extend({},WPGlobusMedia,a),WPGlobusMedia.init()}}(jQuery);
includes/js/wpglobus-options.js ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*jslint browser: true*/
2
+ /*global jQuery, WPGlobusOptions*/
3
+ jQuery(document).ready(function ($) {
4
+ "use strict";
5
+
6
+ if ( 'undefined' === typeof WPGlobusOptions) {
7
+ return;
8
+ }
9
+
10
+ var api = {
11
+ currentTabID: 0,
12
+ firstLanguageCb: null,
13
+ init: function() {
14
+ api.initTab();
15
+ api.checkHandlers();
16
+ api.addListeners();
17
+ },
18
+ setFirstLanguageCb: function() {
19
+ if ( null !== api.firstLanguageCb ) {
20
+ api.firstLanguageCb.off('click');
21
+ }
22
+ $('#enabled_languages-list li input[type="checkbox"]').prop('disabled', false);
23
+ var $elm = $('#enabled_languages-list li').eq(0);
24
+ api.firstLanguageCb = $elm.find('input[type="checkbox"]');
25
+ api.firstLanguageCb.prop('checked','checked');
26
+ api.firstLanguageCb.prop('disabled','disabled');
27
+ api.firstLanguageCb.css({'visibility':'hidden'});
28
+ api.firstLanguageCb.on('click', function(ev){
29
+ ev.preventDefault();
30
+ return false;
31
+ });
32
+ },
33
+ handlerEnabled_languages: function() {
34
+ $('.wpglobus-sortable').sortable({
35
+ placeholder: 'ui-state-highlight',
36
+ update: function(ev, ui){
37
+ $('#enabled_languages-list li input[type="checkbox"]').css({'visibility':'visible'});
38
+ api.setFirstLanguageCb();
39
+ }
40
+ });
41
+ $('.wpglobus-sortable').disableSelection();
42
+ api.setFirstLanguageCb();
43
+ },
44
+ handlerLanguagesTable: function() {
45
+ var tab = $('#wpglobus-options-languagesTable').parents('.wpglobus-options-tab').data('tab');
46
+ $('#wpglobus-options-languagesTable .manage-column.sortable a').each(function(i,e){
47
+ var href = $(e).attr('href');
48
+ if ( -1 != href.indexOf('tab') ) {
49
+ if ( -1 == href.indexOf('tab-from') ) {
50
+ href = href.replace(/tab/, 'tab-from');
51
+ href += '&tab='+tab;
52
+ }
53
+ } else {
54
+ href += '&tab='+tab;
55
+ }
56
+ $(e).attr('href', href)
57
+ });
58
+ },
59
+ checkHandlers: function() {
60
+ $('.wpglobus-options-field').each(function(i,e){
61
+ if ( 'undefined' === typeof $(e).data('js-handler') ) {
62
+ return true;
63
+ }
64
+ var func = $(e).data('js-handler');
65
+ if ( 'function' === typeof api[func] ) {
66
+ api[func]();
67
+ }
68
+ });
69
+ },
70
+ initTab: function() {
71
+ var curTab = $('#section-tab-'+WPGlobusOptions.tab);
72
+ api.currentTabID = WPGlobusOptions.tab;
73
+ if ( 0 == curTab.length ) {
74
+ api.currentTabID = WPGlobusOptions.defaultTab;
75
+ curTab = $('#section-tab-'+api.currentTabID);
76
+ }
77
+ curTab.css({'display':'block'});
78
+ $('#wpglobus-tab-link-'+api.currentTabID).addClass('wpglobus-tab-link-active');
79
+ },
80
+ addListeners: function() {
81
+ $(document).on('click', 'input.wpglobus-enabled_languages', function(event){
82
+ var checked = $(this).prop('checked');
83
+ var id = $(this).attr('rel');
84
+
85
+ if ( checked ) {
86
+ $('#'+id).val('1');
87
+ } else {
88
+ $('#'+id).val('');
89
+ }
90
+
91
+ });
92
+ $(document).on('click', '.wpglobus-tab-link', function(event){
93
+ var tab = $(this).data('tab');
94
+ window.history.pushState("data", "Title", WPGlobusOptions.newUrl.replace('{*}', tab));
95
+ $('.wpglobus-options-tab').css({'display':'none'});
96
+ $('#section-tab-'+tab).css({'display':'block'});
97
+
98
+ $('.wpglobus-tab-link').removeClass('wpglobus-tab-link-active');
99
+ $('#wpglobus-tab-link-'+tab).addClass('wpglobus-tab-link-active');
100
+ $('#wpglobus_options_current_tab').val(tab);
101
+ });
102
+ }
103
+ };
104
+
105
+ WPGlobusOptions = $.extend( {}, WPGlobusOptions, api );
106
+ WPGlobusOptions.init();
107
+ });
includes/js/wpglobus-options.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(i){"use strict";if("undefined"!=typeof WPGlobusOptions){var e={currentTabID:0,firstLanguageCb:null,init:function(){e.initTab(),e.checkHandlers(),e.addListeners()},setFirstLanguageCb:function(){null!==e.firstLanguageCb&&e.firstLanguageCb.off("click"),i('#enabled_languages-list li input[type="checkbox"]').prop("disabled",!1);var a=i("#enabled_languages-list li").eq(0);e.firstLanguageCb=a.find('input[type="checkbox"]'),e.firstLanguageCb.prop("checked","checked"),e.firstLanguageCb.prop("disabled","disabled"),e.firstLanguageCb.css({visibility:"hidden"}),e.firstLanguageCb.on("click",function(a){return a.preventDefault(),!1})},handlerEnabled_languages:function(){i(".wpglobus-sortable").sortable({placeholder:"ui-state-highlight",update:function(a,t){i('#enabled_languages-list li input[type="checkbox"]').css({visibility:"visible"}),e.setFirstLanguageCb()}}),i(".wpglobus-sortable").disableSelection(),e.setFirstLanguageCb()},handlerLanguagesTable:function(){var e=i("#wpglobus-options-languagesTable").parents(".wpglobus-options-tab").data("tab");i("#wpglobus-options-languagesTable .manage-column.sortable a").each(function(a,t){var n=i(t).attr("href");-1!=n.indexOf("tab")?-1==n.indexOf("tab-from")&&(n=n.replace(/tab/,"tab-from"),n+="&tab="+e):n+="&tab="+e,i(t).attr("href",n)})},checkHandlers:function(){i(".wpglobus-options-field").each(function(a,t){if(void 0===i(t).data("js-handler"))return!0;var n=i(t).data("js-handler");"function"==typeof e[n]&&e[n]()})},initTab:function(){var a=i("#section-tab-"+WPGlobusOptions.tab);e.currentTabID=WPGlobusOptions.tab,0==a.length&&(e.currentTabID=WPGlobusOptions.defaultTab,a=i("#section-tab-"+e.currentTabID)),a.css({display:"block"}),i("#wpglobus-tab-link-"+e.currentTabID).addClass("wpglobus-tab-link-active")},addListeners:function(){i(document).on("click","input.wpglobus-enabled_languages",function(a){var t=i(this).prop("checked"),n=i(this).attr("rel");t?i("#"+n).val("1"):i("#"+n).val("")}),i(document).on("click",".wpglobus-tab-link",function(a){var t=i(this).data("tab");window.history.pushState("data","Title",WPGlobusOptions.newUrl.replace("{*}",t)),i(".wpglobus-options-tab").css({display:"none"}),i("#section-tab-"+t).css({display:"block"}),i(".wpglobus-tab-link").removeClass("wpglobus-tab-link-active"),i("#wpglobus-tab-link-"+t).addClass("wpglobus-tab-link-active"),i("#wpglobus_options_current_tab").val(t)})}};WPGlobusOptions=i.extend({},WPGlobusOptions,e),WPGlobusOptions.init()}});
includes/js/wpglobus-plugin-install.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(l){"use strict";if("undefined"!=typeof WPGlobusPluginInstall){var n={pluginInstalled:'<li><span class="button button-disabled">'+WPGlobusPluginInstall.i18n.installed+"</span></li>",columnName:'<a href="{{href}}" class="" target="_blank">{{name}}<img src="{{img}}" class="plugin-icon"></a>',currentVersion:"<strong>"+WPGlobusPluginInstall.i18n.current_version+": </strong>{{version}}",init:function(){l.each(WPGlobusPluginInstall.pluginCard.paid,function(a,t){var i=".plugin-card-"+t;l(i+" .column-rating").css({visibility:"hidden"}),l(i+" .column-downloaded").css({visibility:"hidden"}),l(i+" .column-rating").css({display:"none"}),l(i+" .column-updated").css({display:"none"});1==l(i+" .plugin-action-buttons li").length&&null!==WPGlobusPluginInstall.pluginData[t].plugin_data&&l(i+" .plugin-action-buttons").prepend(n.pluginInstalled),l(i+" .plugin-action-buttons .button").each(function(n,a){l(a).hasClass("install-now")&&l(a).removeClass("install-now").addClass("wpglobus-install-now")}),l(i+" .plugin-action-buttons .wpglobus-install-now").attr("href",WPGlobusPluginInstall.pluginData[t].extra_data.product_url).attr("target","_blank"),l(i+" .open-plugin-details-modal").css({display:"none"});var s=n.columnName.replace("{{href}}",WPGlobusPluginInstall.pluginData[t].extra_data.details_url);s=(s=s.replace("{{name}}",WPGlobusPluginInstall.pluginData[t].card.name)).replace("{{img}}",WPGlobusPluginInstall.pluginData[t].card.icons["1x"]),l(i+" .column-name h3").html(s),null===WPGlobusPluginInstall.pluginData[t].plugin_data?l(i+" .column-updated").css({visibility:"hidden"}):l(i+" .column-updated").html(n.currentVersion.replace("{{version}}",WPGlobusPluginInstall.pluginData[t].plugin_data.Version)),l(i).prepend('<div class="plugin-card-header" style="text-align:center;height:40px;background-color:#00a0d2;padding-top:15px;"><h3 style="color:#fff;">'+WPGlobusPluginInstall.i18n.card_header+"</h3></div>")}),l(".plugin-action-buttons .wpglobus-install-now").css({"background-color":"#0f0"}).text(WPGlobusPluginInstall.i18n.get_it),l(".plugin-card.plugin-card-wpglobus-for-black-studio-widget a").each(function(n,a){var t,i=l(a),s=i.attr("href");-1===s.indexOf("wpglobus-for-black-studio-widget")||i.hasClass("button")||(t=s.replace("wpglobus-for-black-studio-widget",WPGlobusPluginInstall.pluginData["wpglobus-for-black-studio-widget"].extra_data.correctLink),i.attr("href",t))})}};WPGlobusPluginInstall=l.extend({},WPGlobusPluginInstall,n),WPGlobusPluginInstall.init()}});
1
+ jQuery(document).ready(function(s){"use strict";if("undefined"!=typeof WPGlobusPluginInstall){var i={pluginInstalled:'<li><span class="button button-disabled">'+WPGlobusPluginInstall.i18n.installed+"</span></li>",columnName:'<a href="{{href}}" class="" target="_blank">{{name}}<img src="{{img}}" class="plugin-icon"></a>',currentVersion:"<strong>"+WPGlobusPluginInstall.i18n.current_version+": </strong>{{version}}",init:function(){s.each(WPGlobusPluginInstall.pluginCard.paid,function(l,n){var a=".plugin-card-"+n;s(a+" .column-rating").css({visibility:"hidden"}),s(a+" .column-downloaded").css({visibility:"hidden"}),s(a+" .column-rating").css({display:"none"}),s(a+" .column-updated").css({display:"none"}),1==s(a+" .plugin-action-buttons li").length&&null!==WPGlobusPluginInstall.pluginData[n].plugin_data&&s(a+" .plugin-action-buttons").prepend(i.pluginInstalled),s(a+" .plugin-action-buttons .button").each(function(l,n){s(n).hasClass("install-now")&&s(n).removeClass("install-now").addClass("wpglobus-install-now")}),s(a+" .plugin-action-buttons .wpglobus-install-now").attr("href",WPGlobusPluginInstall.pluginData[n].extra_data.product_url).attr("target","_blank"),s(a+" .open-plugin-details-modal").css({display:"none"});var t=i.columnName.replace("{{href}}",WPGlobusPluginInstall.pluginData[n].extra_data.details_url);t=(t=t.replace("{{name}}",WPGlobusPluginInstall.pluginData[n].card.name)).replace("{{img}}",WPGlobusPluginInstall.pluginData[n].card.icons["1x"]),s(a+" .column-name h3").html(t),null===WPGlobusPluginInstall.pluginData[n].plugin_data?s(a+" .column-updated").css({visibility:"hidden"}):s(a+" .column-updated").html(i.currentVersion.replace("{{version}}",WPGlobusPluginInstall.pluginData[n].plugin_data.Version)),s(a).prepend('<div class="plugin-card-header" style="text-align:center;height:40px;background-color:#00a0d2;padding-top:15px;"><h3 style="color:#fff;">'+WPGlobusPluginInstall.i18n.card_header+"</h3></div>")}),s(".plugin-action-buttons .wpglobus-install-now").css({"background-color":"#0f0"}).text(WPGlobusPluginInstall.i18n.get_it),s(".plugin-card.plugin-card-wpglobus-for-black-studio-widget a").each(function(l,n){var a,t=s(n),i=t.attr("href");-1===i.indexOf("wpglobus-for-black-studio-widget")||t.hasClass("button")||(a=i.replace("wpglobus-for-black-studio-widget",WPGlobusPluginInstall.pluginData["wpglobus-for-black-studio-widget"].extra_data.correctLink),t.attr("href",a))})}};WPGlobusPluginInstall=s.extend({},WPGlobusPluginInstall,i),WPGlobusPluginInstall.init()}});
includes/js/wpglobus-vendor-acf.js CHANGED
@@ -13,41 +13,56 @@
13
  jQuery(document).ready(function ($) {
14
  "use strict";
15
 
16
- if (typeof WPGlobusAcf == 'undefined') {
17
  return;
18
  }
 
 
 
19
 
20
  var api = {
21
  option : {},
22
  init : function (args) {
23
  api.option = $.extend(api.option, args);
24
  if (api.option.pro) {
25
- api.startAcf('.acf-field');
26
  } else {
27
  api.startAcf('.acf_postbox .field');
28
  }
29
  api.attachListeners();
30
  },
31
- disabledField: function (id) {
32
  var res = false;
33
- if (api.option.pro) {
34
- var pId = $('#' + id).parents('.acf-field').attr('id');
35
- $.each(WPGlobusAcf.disabledFields, function (i, e) {
36
- if (e == pId) {
37
- res = true;
38
- }
39
- });
40
- } else {
41
- var id = id.replace('acf-field-', '');
42
- $.each(WPGlobusAcf.disabledFields, function (i, e) {
43
- if (e == id) {
44
- res = true;
45
- }
46
- });
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
48
  return res;
49
  },
50
- startAcf : function (acf_class) {
51
  var id;
52
  var style = 'width:90%;';
53
  var element, clone, name;
@@ -58,10 +73,14 @@ jQuery(document).ready(function ($) {
58
  $(acf_class).each(function () {
59
  var $t = $(this), id, h;
60
  if ($t.hasClass('field_type-textarea') || $t.hasClass('acf-field-textarea')) {
61
- id = $t.find('textarea').attr('id');
62
- if (api.disabledField(id)) {
 
 
 
63
  return true;
64
  }
 
65
  h = $('#' + id).height() + 20;
66
  WPGlobusDialogApp.addElement({
67
  id : id,
@@ -71,11 +90,16 @@ jQuery(document).ready(function ($) {
71
  sbTitle : 'Click for edit',
72
  onChangeClass : 'wpglobus-on-change-acf-field'
73
  });
 
74
  } else if ($t.hasClass('field_type-text') || $t.hasClass('acf-field-text')) {
75
- id = $t.find('input').attr('id');
76
- if (api.disabledField(id)) {
 
 
 
77
  return true;
78
  }
 
79
  WPGlobusDialogApp.addElement({
80
  id : id,
81
  dialogTitle : 'Edit ACF field',
@@ -83,9 +107,45 @@ jQuery(document).ready(function ($) {
83
  sbTitle : 'Click for edit',
84
  onChangeClass: 'wpglobus-on-change-acf-field'
85
  });
 
86
  }
87
  });
88
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  attachListeners: function() {
90
  if (api.option.pro) {
91
  /**
13
  jQuery(document).ready(function ($) {
14
  "use strict";
15
 
16
+ if (typeof WPGlobusAcf === 'undefined') {
17
  return;
18
  }
19
+ if (typeof WPGlobusDialogApp === 'undefined') {
20
+ return;
21
+ }
22
 
23
  var api = {
24
  option : {},
25
  init : function (args) {
26
  api.option = $.extend(api.option, args);
27
  if (api.option.pro) {
28
+ api.startAcf('.acf-field');
29
  } else {
30
  api.startAcf('.acf_postbox .field');
31
  }
32
  api.attachListeners();
33
  },
34
+ isDisabledField: function(id) {
35
  var res = false;
36
+
37
+ /**
38
+ * Check for ACF Pro.
39
+ */
40
+ var parentId = $('#' + id).parents('.acf-field').attr('id');
41
+
42
+ if ( 'undefined' !== typeof parentId ) {
43
+ $.each(WPGlobusAcf.disabledFields, function (i, e) {
44
+ if (e == parentId) {
45
+ res = true;
46
+ }
47
+ });
48
+ }
49
+
50
+ if ( res ) {
51
+ return res;
52
+ }
53
+
54
+ /**
55
+ * Check for ACF.
56
+ */
57
+ $.each(WPGlobusAcf.disabledFields, function (i, e) {
58
+ if (e == id) {
59
+ res = true;
60
+ }
61
+ });
62
+
63
  return res;
64
  },
65
+ startAcf: function (acf_class) {
66
  var id;
67
  var style = 'width:90%;';
68
  var element, clone, name;
73
  $(acf_class).each(function () {
74
  var $t = $(this), id, h;
75
  if ($t.hasClass('field_type-textarea') || $t.hasClass('acf-field-textarea')) {
76
+
77
+ id = $t.find('textarea').attr('id');
78
+
79
+ api.registerField(id);
80
+ if (api.isDisabledField(id)) {
81
  return true;
82
  }
83
+
84
  h = $('#' + id).height() + 20;
85
  WPGlobusDialogApp.addElement({
86
  id : id,
90
  sbTitle : 'Click for edit',
91
  onChangeClass : 'wpglobus-on-change-acf-field'
92
  });
93
+
94
  } else if ($t.hasClass('field_type-text') || $t.hasClass('acf-field-text')) {
95
+
96
+ id = $t.find('input').attr('id');
97
+
98
+ api.registerField(id);
99
+ if (api.isDisabledField(id)) {
100
  return true;
101
  }
102
+
103
  WPGlobusDialogApp.addElement({
104
  id : id,
105
  dialogTitle : 'Edit ACF field',
107
  sbTitle : 'Click for edit',
108
  onChangeClass: 'wpglobus-on-change-acf-field'
109
  });
110
+
111
  }
112
  });
113
  },
114
+ registerField: function(id, type) {
115
+ var register = false;
116
+ if ( 'undefined' !== typeof id ) {
117
+ if ( -1 == id.indexOf('acfcloneindex') ) {
118
+ /**
119
+ * Don't register acf clone field.
120
+ * e.g. acf-field_5a5734b531031-acfcloneindex-field_5a573503660e9
121
+ */
122
+ if ( ! api.isRegisteredField(id) ) {
123
+ register = true;
124
+ WPGlobusAcf.fields.push(id);
125
+ }
126
+ }
127
+ }
128
+ if ( register ) {
129
+ return id;
130
+ }
131
+ return false;
132
+ },
133
+ getFields: function() {
134
+ return WPGlobusAcf.fields;
135
+ },
136
+ getDisabledFields: function() {
137
+ return WPGlobusAcf.disabledFields;
138
+ },
139
+ isRegisteredField: function(id) {
140
+ var registered = false;
141
+ api.getFields().forEach(function(elm) {
142
+ if (elm == id) {
143
+ registered = true
144
+ return false;
145
+ }
146
+ });
147
+ return registered;
148
+ },
149
  attachListeners: function() {
150
  if (api.option.pro) {
151
  /**
includes/js/wpglobus-vendor-acf.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){"use strict";if("undefined"!=typeof WPGlobusAcf){var t={option:{},init:function(i){t.option=e.extend(t.option,i),t.option.pro?t.startAcf(".acf-field"):t.startAcf(".acf_postbox .field"),t.attachListeners()},disabledField:function(i){var a=!1;if(t.option.pro){var d=e("#"+i).parents(".acf-field").attr("id");e.each(WPGlobusAcf.disabledFields,function(e,t){t==d&&(a=!0)})}else{i=i.replace("acf-field-","");e.each(WPGlobusAcf.disabledFields,function(e,t){t==i&&(a=!0)})}return a},startAcf:function(i){e(".acf_postbox").parents("#postbox-container-2").length,e(i).each(function(){var i,a,d=e(this);if(d.hasClass("field_type-textarea")||d.hasClass("acf-field-textarea")){if(i=d.find("textarea").attr("id"),t.disabledField(i))return!0;a=e("#"+i).height()+20,WPGlobusDialogApp.addElement({id:i,dialogTitle:"Edit ACF field",style:"width:97%;float:left;",styleTextareaWrapper:"height:"+a+"px;",sbTitle:"Click for edit",onChangeClass:"wpglobus-on-change-acf-field"})}else if(d.hasClass("field_type-text")||d.hasClass("acf-field-text")){if(i=d.find("input").attr("id"),t.disabledField(i))return!0;WPGlobusDialogApp.addElement({id:i,dialogTitle:"Edit ACF field",style:"width:97%;float:left;",sbTitle:"Click for edit",onChangeClass:"wpglobus-on-change-acf-field"})}})},attachListeners:function(){if(t.option.pro){var e=this;acf.add_action&&acf.add_action("append",function(t){e.replaceCloneIndex(t)})}},replaceCloneIndex:function(t){var i=t.data("id");t.find('[data-source-id*="acfcloneindex"]').each(function(){e(this).attr("data-source-id",e(this).attr("data-source-id").replace("acfcloneindex",i))})}};WPGlobusAcf=e.extend({},WPGlobusAcf,t),WPGlobusAcf.init({pro:WPGlobusAcf.pro})}});
1
+ jQuery(document).ready(function(d){"use strict";if("undefined"!=typeof WPGlobusAcf&&"undefined"!=typeof WPGlobusDialogApp){var a={option:{},init:function(e){a.option=d.extend(a.option,e),a.option.pro?a.startAcf(".acf-field"):a.startAcf(".acf_postbox .field"),a.attachListeners()},isDisabledField:function(t){var a=!1,n=d("#"+t).parents(".acf-field").attr("id");return void 0!==n&&d.each(WPGlobusAcf.disabledFields,function(e,i){i==n&&(a=!0)}),a||(d.each(WPGlobusAcf.disabledFields,function(e,i){i==t&&(a=!0)}),a)},startAcf:function(e){d(".acf_postbox").parents("#postbox-container-2").length,d(e).each(function(){var e,i,t=d(this);if(t.hasClass("field_type-textarea")||t.hasClass("acf-field-textarea")){if(e=t.find("textarea").attr("id"),a.registerField(e),a.isDisabledField(e))return!0;i=d("#"+e).height()+20,WPGlobusDialogApp.addElement({id:e,dialogTitle:"Edit ACF field",style:"width:97%;float:left;",styleTextareaWrapper:"height:"+i+"px;",sbTitle:"Click for edit",onChangeClass:"wpglobus-on-change-acf-field"})}else if(t.hasClass("field_type-text")||t.hasClass("acf-field-text")){if(e=t.find("input").attr("id"),a.registerField(e),a.isDisabledField(e))return!0;WPGlobusDialogApp.addElement({id:e,dialogTitle:"Edit ACF field",style:"width:97%;float:left;",sbTitle:"Click for edit",onChangeClass:"wpglobus-on-change-acf-field"})}})},registerField:function(e,i){var t=!1;return void 0!==e&&-1==e.indexOf("acfcloneindex")&&(a.isRegisteredField(e)||(t=!0,WPGlobusAcf.fields.push(e))),!!t&&e},getFields:function(){return WPGlobusAcf.fields},getDisabledFields:function(){return WPGlobusAcf.disabledFields},isRegisteredField:function(i){var t=!1;return a.getFields().forEach(function(e){if(e==i)return t=!0,!1}),t},attachListeners:function(){if(a.option.pro){var i=this;acf.add_action&&acf.add_action("append",function(e){i.replaceCloneIndex(e)})}},replaceCloneIndex:function(e){var i=e.data("id");e.find('[data-source-id*="acfcloneindex"]').each(function(){d(this).attr("data-source-id",d(this).attr("data-source-id").replace("acfcloneindex",i))})}};WPGlobusAcf=d.extend({},WPGlobusAcf,a),WPGlobusAcf.init({pro:WPGlobusAcf.pro})}});
includes/js/wpglobus-vendor-aioseop.min.js CHANGED
@@ -1 +1 @@
1
- var WPGlobusAioseop;!function(a){"use strict";var o;o=WPGlobusAioseop={init:function(){0!=a("#aiosp_snippet_wrapper").size()&&(a("#wpglobus-aioseop-tabs").removeClass("hidden wpglobus-hidden").tabs(),a("#wpglobus-aioseop-tabs").insertBefore(a("#aiosp_snippet_wrapper")),a("#aiosp_snippet_wrapper, #aiosp_title_wrapper, #aiosp_description_wrapper, #aiosp_keywords_wrapper").addClass("hidden"),o.setCounters(),o.attachListeners())},setCounters:function(){a(".wpglobus_countable").each(function(o,t){var e=a(t),s=0,n=e.data("field-count");void 0!==e.data("extra-element")&&(s=a("#"+e.data("extra-element")).data("extra-length")),a("input[name="+n+"]").val(e.val().length+s)})},countChars:function(o,t){var e,s=0,n=(t="input[name="+t+"]",o.data("max-size"));void 0!==o.data("extra-element")&&(s=a("#"+o.data("extra-element")).data("extra-length")),e=o.val().length+s,a(t).val(e),e>n?a(t).css({color:"#fff","background-color":"#f00"}):e>n-6?a(t).css({color:"#515151","background-color":"#ff0"}):a(t).css({color:"#515151","background-color":"#eee"})},attachListeners:function(){a(".wpglobus_countable").on("keyup",function(t){var e=a(this);o.countChars(e,e.data("field-count"))}),a("body").on("click",".wpglobus-post-body-tabs-list li",function(o){var t=a(this);t.hasClass("wpglobus-post-tab")&&a("#wpglobus-aioseop-tabs").tabs("option","active",t.data("order"))}),a(".wpglobus-aioseop_title").on("keyup",function(o){var t=a(this);a("#aioseop_snippet_title_"+t.data("language")).text(t.val())}),a("body").on("change",".wpglobus-aioseop_title",function(o){var t=a(this),e="input[name=aiosp_title]";a(e).val(WPGlobusCore.getString(a(e).val(),t.val(),t.data("language")))}),a(".wpglobus-aioseop_description").on("keyup",function(o){var t=a(this);a("#aioseop_snippet_description_"+t.data("language")).text(t.val())}),a("body").on("change",".wpglobus-aioseop_description",function(o){var t=a(this),e="textarea[name=aiosp_description]";a(e).val(WPGlobusCore.getString(a(e).val(),t.val(),t.data("language")))}),a("body").on("change",".wpglobus-aioseop_keywords",function(o){var t=a(this),e="input[name=aiosp_keywords]";a(e).val(WPGlobusCore.getString(a(e).val(),t.val(),t.data("language")))})}}}(jQuery);
1
+ var WPGlobusAioseop;!function(n){"use strict";var t;t=WPGlobusAioseop={init:function(){0!=n("#aiosp_snippet_wrapper").size()&&(n("#wpglobus-aioseop-tabs").removeClass("hidden wpglobus-hidden").tabs(),n("#wpglobus-aioseop-tabs").insertBefore(n("#aiosp_snippet_wrapper")),n("#aiosp_snippet_wrapper, #aiosp_title_wrapper, #aiosp_description_wrapper, #aiosp_keywords_wrapper").addClass("hidden"),t.setCounters(),t.attachListeners())},setCounters:function(){n(".wpglobus_countable").each(function(a,o){var t=n(o),e=0,s=t.data("field-count");void 0!==t.data("extra-element")&&(e=n("#"+t.data("extra-element")).data("extra-length")),n("input[name="+s+"]").val(t.val().length+e)})},countChars:function(a,o){var t,e=0,s=(o="input[name="+o+"]",a.data("max-size"));void 0!==a.data("extra-element")&&(e=n("#"+a.data("extra-element")).data("extra-length")),t=a.val().length+e,n(o).val(t),s<t?n(o).css({color:"#fff","background-color":"#f00"}):s-6<t?n(o).css({color:"#515151","background-color":"#ff0"}):n(o).css({color:"#515151","background-color":"#eee"})},attachListeners:function(){n(".wpglobus_countable").on("keyup",function(a){var o=n(this);t.countChars(o,o.data("field-count"))}),n("body").on("click",".wpglobus-post-body-tabs-list li",function(a){var o=n(this);o.hasClass("wpglobus-post-tab")&&n("#wpglobus-aioseop-tabs").tabs("option","active",o.data("order"))}),n(".wpglobus-aioseop_title").on("keyup",function(a){var o=n(this);n("#aioseop_snippet_title_"+o.data("language")).text(o.val())}),n("body").on("change",".wpglobus-aioseop_title",function(a){var o=n(this),t="input[name=aiosp_title]";n(t).val(WPGlobusCore.getString(n(t).val(),o.val(),o.data("language")))}),n(".wpglobus-aioseop_description").on("keyup",function(a){var o=n(this);n("#aioseop_snippet_description_"+o.data("language")).text(o.val())}),n("body").on("change",".wpglobus-aioseop_description",function(a){var o=n(this),t="textarea[name=aiosp_description]";n(t).val(WPGlobusCore.getString(n(t).val(),o.val(),o.data("language")))}),n("body").on("change",".wpglobus-aioseop_keywords",function(a){var o=n(this),t="input[name=aiosp_keywords]";n(t).val(WPGlobusCore.getString(n(t).val(),o.val(),o.data("language")))})}}}(jQuery);
includes/js/wpglobus-widgets.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){"use strict";if("undefined"!=typeof WPGlobusWidgets){var t={saveArbitraryTextOrHTML:!1,editor:{},languageBoxActive:!1,languageBoxTimeout:null,init:function(){t.addElements(),t.attachListeners(),t.arbitraryTextOrHTML()},wysiwygClean:function(){e(".wpglobus-dialog-field").each(function(t,i){var a=e(i).data("source-id");if(1==e("#"+a+"-tmce").size()){var o=e(i).next(".wpglobus_dialog_start");e(i).remove(),e(o).remove()}})},setupWidgetControl:function(i,a,o){var n=!1;if(e.each(t.editor,function(e,t){if(t.widgetName==i)return n=!0,!1}),!n){var r=a.$el[0].id;if(""==r){var d=a.$el[0].offsetParent;void 0===(r=e(d).attr("id"))&&e(".widget").each(function(t,a){var o=e(a).attr("id");if(-1!=o.indexOf(i))return r=o,!1})}var l="#"+r+" #widget-"+i+"-text",u="#"+r+" #widget-"+i+"-title";t.editor[o.id]={},t.editor[o.id].widgetName=i,t.editor[o.id].controls=a,t.editor[o.id].sourceTitleSelector=u,t.editor[o.id].titleSelector=null,t.editor[o.id].sourceSelector=l,t.editor[o.id].content=e(l).val(),t.editor[o.id].saveSelector="#"+r+" #widget-"+i+"-savewidget",t.editor[o.id].languageSelector="#"+r+" .wpglobus-current-language",t.editor[o.id].inWidgetTitleSelector="#"+r+" .in-widget-title";var s=WPGlobusCore.TextFilter(t.editor[o.id].content,WPGlobusCoreData.default_language,"RETURN_EMPTY");e("#"+o.id).val(s);var g="",c="";e.each(WPGlobusCoreData.enabled_languages,function(e,t){g=(g=(g=(g=(g=(g=(g='<a href="#" onclick="return false;" class="item" data-widget-id="{{widgetID}}" data-source="{{source}}" data-editor-id="{{editorID}}" data-language="{{language}}" data-widget-name="{{widgetName}}" style="text-align:center;"><span>{{item}}</span></a>').replace("{{language}}",t)).replace("{{item}}",WPGlobusCoreData.en_language_name[t])).replace("{{widgetName}}",i)).replace("{{widgetID}}",r)).replace("{{editorID}}",o.id)).replace("{{source}}",l),c+=g});var f='<button style="z-index:200000;" type="button" id="'+o.id+'-wpglobus-button" data-widget-id="'+r+'"class="wp-switch-editor switch-wpglobus-language wpglobus-icon-globe"><span class="wpglobus-current-language" data-language="en" style="">En</span></button><div class="wpglobus-language-box" style="position:absolute;top:0;left:0;display:none;z-index:200100;border:1px solid #9e9e9e;border-radius:3px;background-color:#fff;padding: 2px 5px;"><div style="display:flex;flex-direction:column;">'+c+"</div></div>";e("#"+r+" .wp-editor-tabs").append(f),WPGlobusDialogApp.addElement({id:a.fields.title[0].id,style:"width:93%;"})&&(t.editor[o.id].titleSelector="#"+a.fields.title[0].id),t.arbitraryWidgetTitle(o.id)}},arbitraryWidgetTitle:function(i){var a=WPGlobusCore.TextFilter(e("#"+t.editor[i].controls.fields.title[0].id).val(),WPGlobusCoreData.language);e(t.editor[i].inWidgetTitleSelector).text(": "+a)},setBoxTimeout:function(){t.languageBoxTimeout=setTimeout(function(){t.languageBoxActive=!1,e(".wpglobus-language-box").css({display:"none"})},1e3)},arbitraryTextOrHTML:function(){e(document).on("click",".switch-wpglobus-language",function(i){if(!t.languageBoxActive){t.languageBoxActive=!0;var a=e(this),o=a.data("widget-id"),n=a.position();n.top+=34,n.left+=10,e("#"+o+" .wpglobus-language-box").css({display:"block",top:n.top+"px",left:n.left+"px"}),t.setBoxTimeout()}}),e(document).on("mouseenter",".wpglobus-language-box",function(e){clearTimeout(t.languageBoxTimeout)}).on("mouseleave",".wpglobus-language-box",function(i){e(".wpglobus-language-box").css({display:"none"}),t.languageBoxActive=!1}),e(document).on("click",".wpglobus-language-box .item",function(i){var a=e(this),o=a.data("language"),n=a.data("widget-id"),r=a.data("editor-id");e("#"+n+" .wpglobus-current-language").text(o).data("language",o);var d=WPGlobusCore.TextFilter(t.editor[r].content,o,"RETURN_EMPTY");tinymce.get(r).setContent(d,{format:"raw"}),e("textarea#"+r).val(d)}),e(document).on("tinymce-editor-setup",function(i,a){e.each(wp.textWidgets.widgetControls,function(e,i){t.setupWidgetControl(e,i,a)})}),e(document).on("tinymce-editor-init",function(a,o){e(document).on("mouseenter",t.editor[o.id].saveSelector,function(i){e(t.editor[o.id].sourceTitleSelector).val(e(t.editor[o.id].titleSelector).val()),e(t.editor[o.id].sourceSelector).val(t.editor[o.id].content)}),e(document).on("click",t.editor[o.id].saveSelector,function(e){t.saveArbitraryTextOrHTML=o.id}),o.on("nodechange keyup",_.debounce(i,100)),e("#"+o.id).on("keyup",_.debounce(i,100))});function i(i){var a="";if(a="keyup"==i.type&&"tinymce"==i.target.id?e(i.target).data("id"):i.target.id,t.editor[a]){var o=e(t.editor[a].languageSelector).data("language"),n="";n=tinymce.get(a).isHidden()?e("#"+a).val():tinymce.get(a).getContent({format:"raw"}),t.editor[a].content=WPGlobusCore.getString(t.editor[a].content,n,o),e(t.editor[a].sourceSelector).val(t.editor[a].content)}}},addElements:function(i,a){var o,n=[];n[0]='input[type="text"]',n[1]="textarea",void 0===i||"class"==i?(o=".widget-liquid-right .widget .widget-content",e.each(n,function(e,i){t.makeClone(o,i)})):"id"==i&&(o="#"+a+" .widget-content",e.each(n,function(e,i){t.makeClone(o,i)}))},makeClone:function(t,i){e(t+" "+i).each(function(t,a){var o,n,r,d,l=e(a),u=!1;if(void 0===(d=l.attr("id"))||-1!=d.indexOf("-number")||""==d)return!0;if(_.each(WPGlobusWidgets.disabledMask,function(e){if(-1!=d.indexOf(e))return u=!0,!1}),u)return!0;if(o=e("#"+d).clone(),e(l).addClass("wpglobus-dialog-field-source hidden"),n=l.attr("name"),e(o).attr("id","wpglobus-"+d),e(o).attr("name","wpglobus-"+n),e(o).attr("data-source-id",d),e(o).attr("class","wpglobus-dialog-field"),e(o).attr("style","width:90%;"),r=WPGlobusCore.TextFilter(e(l).val(),WPGlobusCoreData.language),e(o).val(r),e('<div style="width:20px;" data-type="control" data-source-type="" data-source-id="'+d+'" class="wpglobus-widgets wpglobus_dialog_start wpglobus_dialog_icon"></div>').insertAfter(l),e(o).insertAfter(l),'input[type="text"]'==i&&""!=r){var s=l.parents(".widget").attr("id");e("#"+s+" .in-widget-title").text(": "+r)}})},attachListeners:function(){e(document).ajaxComplete(function(i,a,o){if(-1!=o.data.indexOf("action=save-widget"))if(-1!=o.data.indexOf("delete_widget=1"));else{if(t.saveArbitraryTextOrHTML){var n=WPGlobusCore.TextFilter(t.editor[t.saveArbitraryTextOrHTML].content,e(t.editor[t.saveArbitraryTextOrHTML].languageSelector).data("language"),"RETURN_EMPTY");return tinymce.get(t.saveArbitraryTextOrHTML).isHidden()?(e("#"+t.saveArbitraryTextOrHTML).val(n),e("#"+t.saveArbitraryTextOrHTML+"-tmce").click()):tinymce.get(t.saveArbitraryTextOrHTML).setContent(n,{format:"raw"}),t.arbitraryWidgetTitle(t.saveArbitraryTextOrHTML),void(t.saveArbitraryTextOrHTML=!1)}var r=o.data.split("widget-id=");r=r[1].split("&"),e(".widget-liquid-right .widget").each(function(i,a){var o=e(a).attr("id");-1!==o.indexOf(r[0])&&(t.addElements("id",o),t.wysiwygClean())})}}),e("body").on("change",".wpglobus-dialog-field",function(){var t,i=e(this),a="#"+i.data("source-id"),o="",n="";void 0!==a&&(o=e(a).val(),/(\{:|\[:|<!--:)[a-z]{2}/.test(o)?(e.each(WPGlobusCoreData.enabled_languages,function(e,a){""!=(t=a==WPGlobusCoreData.language?i.val():WPGlobusCore.TextFilter(o,a,"RETURN_EMPTY"))&&(n+=WPGlobusCore.addLocaleMarks(t,a))}),e(a).val(n)):e(a).val(i.val()))}),e(document).on("click",".widget-title, .widget-title-action",function(e){e.preventDefault(),t.wysiwygClean(),t.imageWidget(this)})},imageWidget:function(t){var i=e(t).parents(".widget").attr("id");if(-1!=i.indexOf("media_image")){var a=e("#"+i+" .in-widget-title"),o=e("#"+i).find('input[type="text"]').attr("id");if(-1!=o.indexOf(".")){var n="wpg-"+o.replace(".","_");if(e("#"+i).find('input[type="text"]').attr("name",n),WPGlobusDialogApp.addElement(n)){var r=e("#"+i).find('input[name="'+n+'"]'),d=WPGlobusCore.getTranslations(r.val())[WPGlobusCoreData.language];a.text(": "+d),setTimeout(function(){e("#wpglobus-"+n).val(d)},1e3)}}else if(WPGlobusDialogApp.addElement(o)){d=WPGlobusCore.getTranslations(e("#"+o).val())[WPGlobusCoreData.language];a.text(": "+d),setTimeout(function(){e("#wpglobus-"+o).val(d)},1e3)}}}};WPGlobusWidgets=e.extend({},WPGlobusWidgets,t)}}(jQuery);
1
+ !function(c){"use strict";if("undefined"!=typeof WPGlobusWidgets){var f={saveArbitraryTextOrHTML:!1,editor:{},languageBoxActive:!1,languageBoxTimeout:null,init:function(){f.addElements(),f.attachListeners(),f.arbitraryTextOrHTML()},wysiwygClean:function(){c(".wpglobus-dialog-field").each(function(e,t){var i=c(t).data("source-id");if(1==c("#"+i+"-tmce").size()){var a=c(t).next(".wpglobus_dialog_start");c(t).remove(),c(a).remove()}})},setupWidgetControl:function(a,e,i){var o=!1;if(c.each(f.editor,function(e,t){if(t.widgetName==a)return o=!0,!1}),!o){var n=e.$el[0].id;if(""==n){var t=e.$el[0].offsetParent;void 0===(n=c(t).attr("id"))&&c(".widget").each(function(e,t){var i=c(t).attr("id");if(-1!=i.indexOf(a))return n=i,!1})}var r="#"+n+" #widget-"+a+"-text",d="#"+n+" #widget-"+a+"-title";f.editor[i.id]={},f.editor[i.id].widgetName=a,f.editor[i.id].controls=e,f.editor[i.id].sourceTitleSelector=d,f.editor[i.id].titleSelector=null,f.editor[i.id].sourceSelector=r,f.editor[i.id].content=c(r).val(),f.editor[i.id].saveSelector="#"+n+" #widget-"+a+"-savewidget",f.editor[i.id].languageSelector="#"+n+" .wpglobus-current-language",f.editor[i.id].inWidgetTitleSelector="#"+n+" .in-widget-title";var l=WPGlobusCore.TextFilter(f.editor[i.id].content,WPGlobusCoreData.default_language,"RETURN_EMPTY");c("#"+i.id).val(l);var u="",s="";c.each(WPGlobusCoreData.enabled_languages,function(e,t){u=(u=(u=(u=(u=(u=(u='<a href="#" onclick="return false;" class="item" data-widget-id="{{widgetID}}" data-source="{{source}}" data-editor-id="{{editorID}}" data-language="{{language}}" data-widget-name="{{widgetName}}" style="text-align:center;"><span>{{item}}</span></a>').replace("{{language}}",t)).replace("{{item}}",WPGlobusCoreData.en_language_name[t])).replace("{{widgetName}}",a)).replace("{{widgetID}}",n)).replace("{{editorID}}",i.id)).replace("{{source}}",r),s+=u});var g='<button style="z-index:200000;" type="button" id="'+i.id+'-wpglobus-button" data-widget-id="'+n+'"class="wp-switch-editor switch-wpglobus-language wpglobus-icon-globe"><span class="wpglobus-current-language" data-language="en" style="">En</span></button><div class="wpglobus-language-box" style="position:absolute;top:0;left:0;display:none;z-index:200100;border:1px solid #9e9e9e;border-radius:3px;background-color:#fff;padding: 2px 5px;"><div style="display:flex;flex-direction:column;">'+s+"</div></div>";c("#"+n+" .wp-editor-tabs").append(g),WPGlobusDialogApp.addElement({id:e.fields.title[0].id,style:"width:93%;"})&&(f.editor[i.id].titleSelector="#"+e.fields.title[0].id),f.arbitraryWidgetTitle(i.id)}},arbitraryWidgetTitle:function(e){var t=WPGlobusCore.TextFilter(c("#"+f.editor[e].controls.fields.title[0].id).val(),WPGlobusCoreData.language);c(f.editor[e].inWidgetTitleSelector).text(": "+t)},setBoxTimeout:function(){f.languageBoxTimeout=setTimeout(function(){f.languageBoxActive=!1,c(".wpglobus-language-box").css({display:"none"})},1e3)},arbitraryTextOrHTML:function(){function i(e){var t="";if(t="keyup"==e.type&&"tinymce"==e.target.id?c(e.target).data("id"):e.target.id,f.editor[t]){var i=c(f.editor[t].languageSelector).data("language"),a="";a=tinymce.get(t).isHidden()?c("#"+t).val():tinymce.get(t).getContent({format:"raw"}),f.editor[t].content=WPGlobusCore.getString(f.editor[t].content,a,i),c(f.editor[t].sourceSelector).val(f.editor[t].content)}}c(document).on("click",".switch-wpglobus-language",function(e){if(!f.languageBoxActive){f.languageBoxActive=!0;var t=c(this),i=t.data("widget-id"),a=t.position();a.top+=34,a.left+=10,c("#"+i+" .wpglobus-language-box").css({display:"block",top:a.top+"px",left:a.left+"px"}),f.setBoxTimeout()}}),c(document).on("mouseenter",".wpglobus-language-box",function(e){clearTimeout(f.languageBoxTimeout)}).on("mouseleave",".wpglobus-language-box",function(e){c(".wpglobus-language-box").css({display:"none"}),f.languageBoxActive=!1}),c(document).on("click",".wpglobus-language-box .item",function(e){var t=c(this),i=t.data("language"),a=t.data("widget-id"),o=t.data("editor-id");c("#"+a+" .wpglobus-current-language").text(i).data("language",i);var n=WPGlobusCore.TextFilter(f.editor[o].content,i,"RETURN_EMPTY");tinymce.get(o).setContent(n,{format:"raw"}),c("textarea#"+o).val(n)}),c(document).on("tinymce-editor-setup",function(e,i){c.each(wp.textWidgets.widgetControls,function(e,t){f.setupWidgetControl(e,t,i)})}),c(document).on("tinymce-editor-init",function(e,t){c(document).on("mouseenter",f.editor[t.id].saveSelector,function(e){c(f.editor[t.id].sourceTitleSelector).val(c(f.editor[t.id].titleSelector).val()),c(f.editor[t.id].sourceSelector).val(f.editor[t.id].content)}),c(document).on("click",f.editor[t.id].saveSelector,function(e){f.saveArbitraryTextOrHTML=t.id}),t.on("nodechange keyup",_.debounce(i,100)),c("#"+t.id).on("keyup",_.debounce(i,100))})},addElements:function(e,t){var i,a=[];a[0]='input[type="text"]',a[1]="textarea",void 0===e||"class"==e?(i=".widget-liquid-right .widget .widget-content",c.each(a,function(e,t){f.makeClone(i,t)})):"id"==e&&(i="#"+t+" .widget-content",c.each(a,function(e,t){f.makeClone(i,t)}))},makeClone:function(e,u){c(e+" "+u).each(function(e,t){var i,a,o,n,r=c(t),d=!1;if(void 0===(n=r.attr("id"))||-1!=n.indexOf("-number")||""==n)return!0;if(_.each(WPGlobusWidgets.disabledMask,function(e){if(-1!=n.indexOf(e))return d=!0,!1}),d)return!0;if(i=c("#"+n).clone(),c(r).addClass("wpglobus-dialog-field-source hidden"),a=r.attr("name"),c(i).attr("id","wpglobus-"+n),c(i).attr("name","wpglobus-"+a),c(i).attr("data-source-id",n),c(i).attr("class","wpglobus-dialog-field"),c(i).attr("style","width:90%;"),o=WPGlobusCore.TextFilter(c(r).val(),WPGlobusCoreData.language),c(i).val(o),c('<div style="width:20px;" data-type="control" data-source-type="" data-source-id="'+n+'" class="wpglobus-widgets wpglobus_dialog_start wpglobus_dialog_icon"></div>').insertAfter(r),c(i).insertAfter(r),'input[type="text"]'==u&&""!=o){var l=r.parents(".widget").attr("id");c("#"+l+" .in-widget-title").text(": "+o)}})},attachListeners:function(){c(document).ajaxComplete(function(e,t,i){if(-1!=i.data.indexOf("action=save-widget"))if(-1!=i.data.indexOf("delete_widget=1"));else{if(f.saveArbitraryTextOrHTML){var a=WPGlobusCore.TextFilter(f.editor[f.saveArbitraryTextOrHTML].content,c(f.editor[f.saveArbitraryTextOrHTML].languageSelector).data("language"),"RETURN_EMPTY");return tinymce.get(f.saveArbitraryTextOrHTML).isHidden()?(c("#"+f.saveArbitraryTextOrHTML).val(a),c("#"+f.saveArbitraryTextOrHTML+"-tmce").click()):tinymce.get(f.saveArbitraryTextOrHTML).setContent(a,{format:"raw"}),f.arbitraryWidgetTitle(f.saveArbitraryTextOrHTML),void(f.saveArbitraryTextOrHTML=!1)}var o=i.data.split("widget-id=");o=o[1].split("&"),c(".widget-liquid-right .widget").each(function(e,t){var i=c(t).attr("id");-1!==i.indexOf(o[0])&&(f.addElements("id",i),f.wysiwygClean())})}}),c("body").on("change",".wpglobus-dialog-field",function(){var i,a,o=c(this),e="#"+o.data("source-id"),n="";void 0!==e&&(i=c(e).val(),/(\{:|\[:|<!--:)[a-z]{2}/.test(i)?(c.each(WPGlobusCoreData.enabled_languages,function(e,t){""!=(a=t==WPGlobusCoreData.language?o.val():WPGlobusCore.TextFilter(i,t,"RETURN_EMPTY"))&&(n+=WPGlobusCore.addLocaleMarks(a,t))}),c(e).val(n)):c(e).val(o.val()))}),c(document).on("click",".widget-title, .widget-title-action",function(e){e.preventDefault(),f.wysiwygClean(),f.imageWidget(this)})},imageWidget:function(e){var t=c(e).parents(".widget").attr("id");if(-1!=t.indexOf("media_image")){var i=c("#"+t+" .in-widget-title"),a=c("#"+t).find('input[type="text"]').attr("id");if(-1!=a.indexOf(".")){var o="wpg-"+a.replace(".","_");if(c("#"+t).find('input[type="text"]').attr("name",o),WPGlobusDialogApp.addElement(o)){var n=c("#"+t).find('input[name="'+o+'"]'),r=WPGlobusCore.getTranslations(n.val())[WPGlobusCoreData.language];i.text(": "+r),setTimeout(function(){c("#wpglobus-"+o).val(r)},1e3)}}else if(WPGlobusDialogApp.addElement(a)){r=WPGlobusCore.getTranslations(c("#"+a).val())[WPGlobusCoreData.language];i.text(": "+r),setTimeout(function(){c("#wpglobus-"+a).val(r)},1e3)}}}};WPGlobusWidgets=c.extend({},WPGlobusWidgets,f)}}(jQuery);
includes/js/wpglobus-wpseo-21.min.js CHANGED
@@ -1 +1 @@
1
- var wpglobus_wpseo=function(){if("undefined"!=typeof wpseoMetaboxL10n){var e=function(e,t){var a="",s=jQuery("#"+wpseoMetaboxL10n.field_prefix+"title_"+t),o=jQuery("#"+wpseoMetaboxL10n.field_prefix+"title-length-warning_"+t),n=jQuery("<div />"),r=jQuery("#wpseosnippet_title_"+t);if(s.val()?a=s.val():(a=wpseoMetaboxL10n.wpseo_title_template,a=n.html(a).text()),""==a)return r.html(""),void o.hide();a=yst_clean(a),a=jQuery.trim(a),a=n.text(a).html(),e&&s.val(a),a=function(e,t,a){if(void 0===e)return"";if("undefined"==typeof replacedVars&&0==jQuery("#title").size())return e;var s="#title",o="#excerpt-"+t,n="#content";t!=WPGlobusAdmin.data.default_language&&(s="#title_"+t,n="#content_"+t),jQuery(s).length&&(e=e.replace(/%%title%%/g,jQuery(s).val())),e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/%%sitedesc%%/g,WPGlobusAdmin.data.blogdescription[t])).replace(/%%sitename%%/g,WPGlobusAdmin.data.blogname[t])).replace(/%%sep%%/g,wpseoMetaboxL10n.sep)).replace(/%%date%%/g,wpseoMetaboxL10n.date)).replace(/%%id%%/g,wpseoMetaboxL10n.id)).replace(/%%page%%/g,wpseoMetaboxL10n.page)).replace(/%%currenttime%%/g,wpseoMetaboxL10n.currenttime)).replace(/%%currentdate%%/g,wpseoMetaboxL10n.currentdate)).replace(/%%currentday%%/g,wpseoMetaboxL10n.currentday)).replace(/%%currentmonth%%/g,wpseoMetaboxL10n.currentmonth)).replace(/%%currentyear%%/g,wpseoMetaboxL10n.currentyear)).replace(/%%focuskw%%/g,jQuery("#yoast_wpseo_focuskw_"+t).val());var r="";jQuery(o).length&&(r=yst_clean(jQuery(o).val()),e=e.replace(/%%excerpt_only%%/g,r)),""==r&&jQuery(n).length&&(r=jQuery(n).val().replace(/(<([^>]+)>)/gi,"").substring(0,wpseoMetaboxL10n.wpseo_meta_desc_length-1)),e=e.replace(/%%excerpt%%/g,r),jQuery("#parent_id").length&&jQuery("#parent_id option:selected").text()!=wpseoMetaboxL10n.no_parent_text&&(e=e.replace(/%%parent_title%%/g,jQuery("#parent_id option:selected").text()));var l=yst_escapeFocusKw(wpseoMetaboxL10n.sep),p=new RegExp(l+" "+l,"g");if(-1!=(e=e.replace(p,wpseoMetaboxL10n.sep)).indexOf("%%")&&null!=e.match(/%%[a-z0-9_-]+%%/i))for(regex=/%%[a-z0-9_-]+%%/gi,matches=e.match(regex),i=0;i<matches.length;i++)void 0!=replacedVars[matches[i]]?e=e.replace(matches[i],replacedVars[matches[i]]):(replaceableVar=matches[i],replacedVars[replaceableVar]="",jQuery.post(ajaxurl,{action:"wpseo_replace_vars",string:matches[i],post_id:jQuery("#post_ID").val(),_wpnonce:wpseoMetaboxL10n.wpseo_replace_vars_nonce},function(t){t?(replacedVars[replaceableVar]=t,yst_replaceVariables(e,a)):yst_replaceVariables(e,a)}));a(e)}(a,t,function(e){var a=n.html(e).text();s.attr("placeholder",a),e=l(e=yst_clean(e),!1,t),jQuery("#wpseosnippet_title_"+t).html(e);var r=document.getElementById("wpseosnippet_title_"+t);null!=r&&(r.scrollWidth>r.clientWidth?o.show():o.hide()),u(t)})},t=function(t){e(!1,t),p(t)};jQuery("#wpglobus-wpseo-tabs").tabs();var a=jQuery("#wpglobus-wpseo-attr"),s=jQuery(".wpseotab.general .form-table"),o=a.data("ids"),n=a.data("names"),r="";o=(o=o+","+a.data("qtip")).split(","),n=n.split(","),jQuery("#wpglobus-wpseo-tabs").insertBefore(s),jQuery(".wpglobus-wpseo-general").each(function(a,l){var u=jQuery(l),i=u.data("language");if(u.html('<table class="form-table wpglobus-table-'+i+'" data-language="'+i+'">'+s.html()+"</table>"),jQuery.each(n,function(e,t){jQuery("#"+t).attr("name",t+"_"+i)}),jQuery.each(o,function(e,t){var a=jQuery("#"+t);"wpseosnippet"==t&&a.addClass("wpglobus-wpseosnippet"),"focuskwresults"==t&&a.addClass("wpglobus-focuskwresults"),wpseoMetaboxL10n.field_prefix+"metadesc"==t&&a.addClass("wpglobus-wpseo_metadesc").text(u.data("metadesc")),wpseoMetaboxL10n.field_prefix+"title"==t&&a.addClass("wpglobus-wpseo_title").val(u.data("wpseotitle")),wpseoMetaboxL10n.field_prefix+"focuskw"==t&&a.addClass("wpglobus-wpseo_focuskw").val(u.data("focuskw")),a.attr("id",t+"_"+i),jQuery("#"+t+"_"+i).attr("data-language",i)}),r="complete"==u.data("permalink")?u.data("url-"+i):u.data("url-"+i)+jQuery("#editable-post-name-full").text()+"/",jQuery("#wpseosnippet_"+i+" .url").text(r),t(i),void 0!==jQuery().autocomplete){var c,d={};jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+i).autocomplete({minLength:3,formatResult:function(e){return jQuery("<div/>").html(e).html()},source:function(e,t){var a=e.term;a in d?t(d[a]):(e._ajax_nonce=wpseoMetaboxL10n.wpseo_keyword_suggest_nonce,e.action="wpseo_get_suggest",c=jQuery.getJSON(ajaxurl,e,function(e,s,o){d[a]=e,o===c&&t(e)}))}})}jQuery("#"+wpseoMetaboxL10n.field_prefix+"title_"+i).keyup(function(){e(!1,jQuery(this).data("language"))}),jQuery("#title_"+i).keyup(function(){var t=jQuery(this).data("language")?jQuery(this).data("language"):WPGlobusAdmin.data.default_language;e(!1,t),p(t)}),0==a&&jQuery("#title").keyup(function(){e(!1,WPGlobusAdmin.data.default_language),p(WPGlobusAdmin.data.default_language)}),0==a&&jQuery("body").on("change","#parent_id",function(){jQuery.each(WPGlobusAdmin.data.enabled_languages,function(t,a){e(!1,a),p(a)})}),jQuery("#"+wpseoMetaboxL10n.field_prefix+"metadesc_"+i).keyup(function(){p(jQuery(this).data("language"))}),jQuery("body").on("keyup","#excerpt-"+i,function(){p(jQuery(this).data("language")?jQuery(this).data("language"):WPGlobusAdmin.data.default_language)}),0==a&&jQuery(".wpglobus-editor").focusout(function(){p(jQuery(this).data("language"))});var _=!1;jQuery(document).on("change","#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+i,function(){var e=jQuery(this).data("language"),a=jQuery("#focuskwhelp_"+e);-1!=jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+e).val().search(",")?(a.click(),_=!0):_&&(a.qtip("hide"),_=!1),t(e)})}),s.addClass("hidden"),jQuery("body").on("change",".wpglobus-wpseo_metadesc",function(e){var t="#"+wpseoMetaboxL10n.field_prefix+"metadesc",a=jQuery(this);jQuery(t).val(WPGlobusCore.getString(jQuery(t).val(),a.val(),a.data("language")))}),jQuery("body").on("change",".wpglobus-wpseo_title",function(e){var t="#"+wpseoMetaboxL10n.field_prefix+"title",a=jQuery(this);jQuery(t).val(WPGlobusCore.getString(jQuery(t).val(),a.val(),a.data("language")))}),jQuery("body").on("change",".wpglobus-wpseo_focuskw",function(e){var t="#"+wpseoMetaboxL10n.field_prefix+"focuskw",a=jQuery(this);jQuery(t).val(WPGlobusCore.getString(jQuery(t).val(),a.val(),a.data("language")))}),jQuery("body").on("click",".wpglobus-post-body-tabs-list li",function(e){$this=jQuery(this),$this.hasClass("wpglobus-post-tab")&&jQuery("#wpglobus-wpseo-tabs").tabs("option","active",jQuery(this).data("order"))}),jQuery(".yoast_help").qtip({content:{attr:"alt"},position:{my:"bottom left",at:"top center"},style:{tip:{corner:!0},classes:"yoast-qtip qtip-rounded qtip-blue"},show:{when:{event:"mouseover"}},hide:{fixed:!0,when:{event:"mouseout"}}}),yst_updateSnippet()}function l(e,t,a){var s,o=yst_escapeFocusKw(jQuery.trim(jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+a).val()));if(""==o)return e;s=-1!=o.search(" ")?o.split(" "):new Array(o);for(var n=0;n<s.length;n++){var r=yst_clean(s[n]),l="";t?(r=r.replace(" ","-").toLowerCase(),l=new RegExp("([-/])("+r+")([-/])?")):l=new RegExp("(^|[ s\n\r\t.,'(\"+;!?:-]+)("+r+")($|[ s\n\r\t.,')\"+;!?:-]+)","gim"),void 0!=e&&(e=e.replace(l,"$1<strong>$2</strong>$3"))}return e}function p(e){var t=jQuery.trim(yst_clean(jQuery("#"+wpseoMetaboxL10n.field_prefix+"metadesc_"+e).val())),a=jQuery("<div />"),s=jQuery("#wpseosnippet_"+e);if(""==t&&""!=wpseoMetaboxL10n.wpseo_metadesc_template&&(t=wpseoMetaboxL10n.wpseo_metadesc_template),""!=t)t=yst_replaceVariables(t,function(t){t=a.text(t).html(),t=yst_clean(t);var o;o=(o=wpseoMetaboxL10n.wpseo_meta_desc_length-t.length)<0?'<span class="wrong">'+o+"</span>":'<span class="good">'+o+"</span>",jQuery("#"+wpseoMetaboxL10n.field_prefix+"metadesc-length_"+e).html(o),t=l(t=yst_trimDesc(t),!1),s.find(".desc span.autogen").html(""),s.find(".desc span.content").html(t),u(e)});else{jQuery("#"+wpseoMetaboxL10n.field_prefix+"metadesc-length_"+e).html(wpseoMetaboxL10n.wpseo_meta_desc_length),s.find(".desc span.content").html(""),u(e);var o="#content";e!=WPGlobusAdmin.data.default_language&&(o="#content_"+e),jQuery(o).length&&(t=jQuery(o).val(),t=yst_clean(t));var n=yst_escapeFocusKw(jQuery.trim(jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+e).val()));if(""!=n){var r=new RegExp(n,"gim");t=-1!=t.search(r)&&t.length>wpseoMetaboxL10n.wpseo_meta_desc_length?t.substr(t.search(r),wpseoMetaboxL10n.wpseo_meta_desc_length):t.substr(0,wpseoMetaboxL10n.wpseo_meta_desc_length)}else t=t.substr(0,wpseoMetaboxL10n.wpseo_meta_desc_length);t=l(t,!1),t=yst_trimDesc(t),s.find(".desc span.autogen").html(t)}}function u(e){var t=jQuery.trim(jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+e).val());t=yst_escapeFocusKw(t).toLowerCase();var a="#title",s="#content";e!=WPGlobusAdmin.data.default_language&&(a="#title_"+e,s="#content_"+e);var o=jQuery(document).triggerHandler("wpglobus_post_name_full",{postnamefull:"#editable-post-name-full",language:e})||"#editable-post-name-full";if(jQuery(o).length)var n=jQuery(o).text(),r=wpseoMetaboxL10n.wpseo_permalink_template.replace("%postname%",n).replace("http://","");var l=new RegExp("(^|[ s\n\r\t.,'(\"+;!?:-])"+t+"($|[ s\n\r\t.,')\"+!?:;-])","gim"),p=removeLowerCaseDiacritics(t),u=new RegExp(p.replace(/\s+/g,"[-_\\//]"),"gim"),i=jQuery("#focuskwresults_"+e),c=jQuery("#wpseosnippet_"+e).find(".desc span.content").text();if(""!=t){var d="<p>"+wpseoMetaboxL10n.keyword_header+"</p>";d+="<ul>",jQuery(a).length&&(d+="<li>"+wpseoMetaboxL10n.article_header_text+ptest(jQuery(a).val(),l)+"</li>"),d+="<li>"+wpseoMetaboxL10n.page_title_text+ptest(jQuery("#wpseosnippet_title_"+e).text(),l)+"</li>",d+="<li>"+wpseoMetaboxL10n.page_url_text+ptest(r,u)+"</li>",jQuery(s).length&&(d+="<li>"+wpseoMetaboxL10n.content_text+ptest(jQuery(s).val(),l)+"</li>"),d+="<li>"+wpseoMetaboxL10n.meta_description_text+ptest(c,l)+"</li>",d+="</ul>",i.html(d)}else i.html("")}};
1
+ var wpglobus_wpseo=function(){if("undefined"!=typeof wpseoMetaboxL10n){var l=function(e,s){var t="",o=jQuery("#"+wpseoMetaboxL10n.field_prefix+"title_"+s),n=jQuery("#"+wpseoMetaboxL10n.field_prefix+"title-length-warning_"+s),r=jQuery("<div />"),a=jQuery("#wpseosnippet_title_"+s);if(o.val()?t=o.val():(t=wpseoMetaboxL10n.wpseo_title_template,t=r.html(t).text()),""==t)return a.html(""),void n.hide();t=yst_clean(t),t=jQuery.trim(t),t=r.text(t).html(),e&&o.val(t),t=function(t,e,a){if(void 0===t)return"";if("undefined"==typeof replacedVars&&0==jQuery("#title").size())return t;var s="#title",o="#excerpt-"+e,n="#content";e!=WPGlobusAdmin.data.default_language&&(s="#title_"+e,n="#content_"+e),jQuery(s).length&&(t=t.replace(/%%title%%/g,jQuery(s).val())),t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(/%%sitedesc%%/g,WPGlobusAdmin.data.blogdescription[e])).replace(/%%sitename%%/g,WPGlobusAdmin.data.blogname[e])).replace(/%%sep%%/g,wpseoMetaboxL10n.sep)).replace(/%%date%%/g,wpseoMetaboxL10n.date)).replace(/%%id%%/g,wpseoMetaboxL10n.id)).replace(/%%page%%/g,wpseoMetaboxL10n.page)).replace(/%%currenttime%%/g,wpseoMetaboxL10n.currenttime)).replace(/%%currentdate%%/g,wpseoMetaboxL10n.currentdate)).replace(/%%currentday%%/g,wpseoMetaboxL10n.currentday)).replace(/%%currentmonth%%/g,wpseoMetaboxL10n.currentmonth)).replace(/%%currentyear%%/g,wpseoMetaboxL10n.currentyear)).replace(/%%focuskw%%/g,jQuery("#yoast_wpseo_focuskw_"+e).val());var r="";jQuery(o).length&&(r=yst_clean(jQuery(o).val()),t=t.replace(/%%excerpt_only%%/g,r)),""==r&&jQuery(n).length&&(r=jQuery(n).val().replace(/(<([^>]+)>)/gi,"").substring(0,wpseoMetaboxL10n.wpseo_meta_desc_length-1)),t=t.replace(/%%excerpt%%/g,r),jQuery("#parent_id").length&&jQuery("#parent_id option:selected").text()!=wpseoMetaboxL10n.no_parent_text&&(t=t.replace(/%%parent_title%%/g,jQuery("#parent_id option:selected").text()));var l=yst_escapeFocusKw(wpseoMetaboxL10n.sep),p=new RegExp(l+" "+l,"g");if(-1!=(t=t.replace(p,wpseoMetaboxL10n.sep)).indexOf("%%")&&null!=t.match(/%%[a-z0-9_-]+%%/i))for(regex=/%%[a-z0-9_-]+%%/gi,matches=t.match(regex),i=0;i<matches.length;i++)null!=replacedVars[matches[i]]?t=t.replace(matches[i],replacedVars[matches[i]]):(replaceableVar=matches[i],replacedVars[replaceableVar]="",jQuery.post(ajaxurl,{action:"wpseo_replace_vars",string:matches[i],post_id:jQuery("#post_ID").val(),_wpnonce:wpseoMetaboxL10n.wpseo_replace_vars_nonce},function(e){e&&(replacedVars[replaceableVar]=e),yst_replaceVariables(t,a)}));a(t)}(t,s,function(e){var t=r.html(e).text();o.attr("placeholder",t),e=_(e=yst_clean(e),!1,s),jQuery("#wpseosnippet_title_"+s).html(e);var a=document.getElementById("wpseosnippet_title_"+s);null!=a&&(a.scrollWidth>a.clientWidth?n.show():n.hide()),y(s)})},p=function(e){l(!1,e),w(e)};jQuery("#wpglobus-wpseo-tabs").tabs();var e=jQuery("#wpglobus-wpseo-attr"),u=jQuery(".wpseotab.general .form-table"),c=e.data("ids"),d=e.data("names"),g="";c=(c=c+","+e.data("qtip")).split(","),d=d.split(","),jQuery("#wpglobus-wpseo-tabs").insertBefore(u),jQuery(".wpglobus-wpseo-general").each(function(e,t){var s=jQuery(t),o=s.data("language");if(s.html('<table class="form-table wpglobus-table-'+o+'" data-language="'+o+'">'+u.html()+"</table>"),jQuery.each(d,function(e,t){jQuery("#"+t).attr("name",t+"_"+o)}),jQuery.each(c,function(e,t){var a=jQuery("#"+t);"wpseosnippet"==t&&a.addClass("wpglobus-wpseosnippet"),"focuskwresults"==t&&a.addClass("wpglobus-focuskwresults"),wpseoMetaboxL10n.field_prefix+"metadesc"==t&&a.addClass("wpglobus-wpseo_metadesc").text(s.data("metadesc")),wpseoMetaboxL10n.field_prefix+"title"==t&&a.addClass("wpglobus-wpseo_title").val(s.data("wpseotitle")),wpseoMetaboxL10n.field_prefix+"focuskw"==t&&a.addClass("wpglobus-wpseo_focuskw").val(s.data("focuskw")),a.attr("id",t+"_"+o),jQuery("#"+t+"_"+o).attr("data-language",o)}),g="complete"==s.data("permalink")?s.data("url-"+o):s.data("url-"+o)+jQuery("#editable-post-name-full").text()+"/",jQuery("#wpseosnippet_"+o+" .url").text(g),p(o),void 0!==jQuery().autocomplete){var n,r={};jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+o).autocomplete({minLength:3,formatResult:function(e){return jQuery("<div/>").html(e).html()},source:function(e,s){var o=e.term;o in r?s(r[o]):(e._ajax_nonce=wpseoMetaboxL10n.wpseo_keyword_suggest_nonce,e.action="wpseo_get_suggest",n=jQuery.getJSON(ajaxurl,e,function(e,t,a){r[o]=e,a===n&&s(e)}))}})}jQuery("#"+wpseoMetaboxL10n.field_prefix+"title_"+o).keyup(function(){l(!1,jQuery(this).data("language"))}),jQuery("#title_"+o).keyup(function(){var e=jQuery(this).data("language")?jQuery(this).data("language"):WPGlobusAdmin.data.default_language;l(!1,e),w(e)}),0==e&&jQuery("#title").keyup(function(){l(!1,WPGlobusAdmin.data.default_language),w(WPGlobusAdmin.data.default_language)}),0==e&&jQuery("body").on("change","#parent_id",function(){jQuery.each(WPGlobusAdmin.data.enabled_languages,function(e,t){l(!1,t),w(t)})}),jQuery("#"+wpseoMetaboxL10n.field_prefix+"metadesc_"+o).keyup(function(){w(jQuery(this).data("language"))}),jQuery("body").on("keyup","#excerpt-"+o,function(){w(jQuery(this).data("language")?jQuery(this).data("language"):WPGlobusAdmin.data.default_language)}),0==e&&jQuery(".wpglobus-editor").focusout(function(){w(jQuery(this).data("language"))});var a=!1;jQuery(document).on("change","#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+o,function(){var e=jQuery(this).data("language"),t=jQuery("#focuskwhelp_"+e);-1!=jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+e).val().search(",")?(t.click(),a=!0):a&&(t.qtip("hide"),a=!1),p(e)})}),u.addClass("hidden"),jQuery("body").on("change",".wpglobus-wpseo_metadesc",function(e){var t="#"+wpseoMetaboxL10n.field_prefix+"metadesc",a=jQuery(this);jQuery(t).val(WPGlobusCore.getString(jQuery(t).val(),a.val(),a.data("language")))}),jQuery("body").on("change",".wpglobus-wpseo_title",function(e){var t="#"+wpseoMetaboxL10n.field_prefix+"title",a=jQuery(this);jQuery(t).val(WPGlobusCore.getString(jQuery(t).val(),a.val(),a.data("language")))}),jQuery("body").on("change",".wpglobus-wpseo_focuskw",function(e){var t="#"+wpseoMetaboxL10n.field_prefix+"focuskw",a=jQuery(this);jQuery(t).val(WPGlobusCore.getString(jQuery(t).val(),a.val(),a.data("language")))}),jQuery("body").on("click",".wpglobus-post-body-tabs-list li",function(e){$this=jQuery(this),$this.hasClass("wpglobus-post-tab")&&jQuery("#wpglobus-wpseo-tabs").tabs("option","active",jQuery(this).data("order"))}),jQuery(".yoast_help").qtip({content:{attr:"alt"},position:{my:"bottom left",at:"top center"},style:{tip:{corner:!0},classes:"yoast-qtip qtip-rounded qtip-blue"},show:{when:{event:"mouseover"}},hide:{fixed:!0,when:{event:"mouseout"}}}),yst_updateSnippet()}function _(e,t,a){var s,o=yst_escapeFocusKw(jQuery.trim(jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+a).val()));if(""==o)return e;s=-1!=o.search(" ")?o.split(" "):new Array(o);for(var n=0;n<s.length;n++){var r=yst_clean(s[n]),l="";t?(r=r.replace(" ","-").toLowerCase(),l=new RegExp("([-/])("+r+")([-/])?")):l=new RegExp("(^|[ s\n\r\t.,'(\"+;!?:-]+)("+r+")($|[ s\n\r\t.,')\"+;!?:-]+)","gim"),null!=e&&(e=e.replace(l,"$1<strong>$2</strong>$3"))}return e}function w(a){var e=jQuery.trim(yst_clean(jQuery("#"+wpseoMetaboxL10n.field_prefix+"metadesc_"+a).val())),s=jQuery("<div />"),o=jQuery("#wpseosnippet_"+a);if(""==e&&""!=wpseoMetaboxL10n.wpseo_metadesc_template&&(e=wpseoMetaboxL10n.wpseo_metadesc_template),""!=e)e=yst_replaceVariables(e,function(e){var t;e=s.text(e).html(),e=yst_clean(e),t=(t=wpseoMetaboxL10n.wpseo_meta_desc_length-e.length)<0?'<span class="wrong">'+t+"</span>":'<span class="good">'+t+"</span>",jQuery("#"+wpseoMetaboxL10n.field_prefix+"metadesc-length_"+a).html(t),e=_(e=yst_trimDesc(e),!1),o.find(".desc span.autogen").html(""),o.find(".desc span.content").html(e),y(a)});else{jQuery("#"+wpseoMetaboxL10n.field_prefix+"metadesc-length_"+a).html(wpseoMetaboxL10n.wpseo_meta_desc_length),o.find(".desc span.content").html(""),y(a);var t="#content";a!=WPGlobusAdmin.data.default_language&&(t="#content_"+a),jQuery(t).length&&(e=jQuery(t).val(),e=yst_clean(e));var n=yst_escapeFocusKw(jQuery.trim(jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+a).val()));if(""!=n){var r=new RegExp(n,"gim");e=-1!=e.search(r)&&e.length>wpseoMetaboxL10n.wpseo_meta_desc_length?e.substr(e.search(r),wpseoMetaboxL10n.wpseo_meta_desc_length):e.substr(0,wpseoMetaboxL10n.wpseo_meta_desc_length)}else e=e.substr(0,wpseoMetaboxL10n.wpseo_meta_desc_length);e=_(e,!1),e=yst_trimDesc(e),o.find(".desc span.autogen").html(e)}}function y(e){var t=jQuery.trim(jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+e).val());t=yst_escapeFocusKw(t).toLowerCase();var a="#title",s="#content";e!=WPGlobusAdmin.data.default_language&&(a="#title_"+e,s="#content_"+e);var o=jQuery(document).triggerHandler("wpglobus_post_name_full",{postnamefull:"#editable-post-name-full",language:e})||"#editable-post-name-full";if(jQuery(o).length)var n=jQuery(o).text(),r=wpseoMetaboxL10n.wpseo_permalink_template.replace("%postname%",n).replace("http://","");var l=new RegExp("(^|[ s\n\r\t.,'(\"+;!?:-])"+t+"($|[ s\n\r\t.,')\"+!?:;-])","gim"),p=removeLowerCaseDiacritics(t),u=new RegExp(p.replace(/\s+/g,"[-_\\//]"),"gim"),i=jQuery("#focuskwresults_"+e),c=jQuery("#wpseosnippet_"+e).find(".desc span.content").text();if(""!=t){var d="<p>"+wpseoMetaboxL10n.keyword_header+"</p>";d+="<ul>",jQuery(a).length&&(d+="<li>"+wpseoMetaboxL10n.article_header_text+ptest(jQuery(a).val(),l)+"</li>"),d+="<li>"+wpseoMetaboxL10n.page_title_text+ptest(jQuery("#wpseosnippet_title_"+e).text(),l)+"</li>",d+="<li>"+wpseoMetaboxL10n.page_url_text+ptest(r,u)+"</li>",jQuery(s).length&&(d+="<li>"+wpseoMetaboxL10n.content_text+ptest(jQuery(s).val(),l)+"</li>"),d+="<li>"+wpseoMetaboxL10n.meta_description_text+ptest(c,l)+"</li>",d+="</ul>",i.html(d)}else i.html("")}};
includes/js/wpglobus-wpseo-22.min.js CHANGED
@@ -1 +1 @@
1
- "use strict";var wpglobus_wpseo=function(){if("undefined"!=typeof wpseoMetaboxL10n){var e=function(e,t){var a="",s=jQuery("#"+wpseoMetaboxL10n.field_prefix+"title_"+t),n=jQuery("#"+wpseoMetaboxL10n.field_prefix+"title-length-warning_"+t),o=jQuery("<div />"),l=jQuery("#wpseosnippet_title_"+t);if(s.val()?a=s.val().replace(/(<([^>]+)>)/gi,""):(a=wpseoMetaboxL10n.wpseo_title_template,a=o.html(a).text()),""===a)return l.html(""),void n.hide();a=ystClean(a),a=jQuery.trim(a),a=o.text(a).html(),e&&s.val(a),a=function(e,t,a){if(void 0!==e){if("undefined"==typeof replacedVars&&0==jQuery("#title").size())return e;var s="#title",n="#excerpt-"+t,o="#content";t!=WPGlobusAdmin.data.default_language&&(s="#title_"+t,o="#content_"+t),jQuery(s).length&&(e=e.replace(/%%title%%/g,jQuery(s).val().replace(/(<([^>]+)>)/gi,""))),e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/%%sitedesc%%/g,WPGlobusAdmin.data.blogdescription[t])).replace(/%%sitename%%/g,WPGlobusAdmin.data.blogname[t])).replace(/%%sep%%/g,wpseoMetaboxL10n.sep)).replace(/%%date%%/g,wpseoMetaboxL10n.date)).replace(/%%id%%/g,wpseoMetaboxL10n.id)).replace(/%%page%%/g,wpseoMetaboxL10n.page)).replace(/%%currenttime%%/g,wpseoMetaboxL10n.currenttime)).replace(/%%currentdate%%/g,wpseoMetaboxL10n.currentdate)).replace(/%%currentday%%/g,wpseoMetaboxL10n.currentday)).replace(/%%currentmonth%%/g,wpseoMetaboxL10n.currentmonth)).replace(/%%currentyear%%/g,wpseoMetaboxL10n.currentyear)).replace(/%%focuskw%%/g,jQuery("#yoast_wpseo_focuskw_"+t).val().replace(/(<([^>]+)>)/gi,""));var l="";jQuery(n).length&&(l=ystClean(jQuery(n).val().replace(/(<([^>]+)>)/gi,"")),e=e.replace(/%%excerpt_only%%/g,l)),""===l&&jQuery(o).length&&(l=jQuery(o).val().replace(/(<([^>]+)>)/gi,"").substring(0,wpseoMetaboxL10n.wpseo_meta_desc_length-1)),e=e.replace(/%%excerpt%%/g,l),jQuery("#parent_id").length&&jQuery("#parent_id option:selected").text()!==wpseoMetaboxL10n.no_parent_text&&(e=e.replace(/%%parent_title%%/g,jQuery("#parent_id option:selected").text()));var r=ystEscapeFocusKw(wpseoMetaboxL10n.sep),u=new RegExp(r+" "+r,"g");if(-1!==(e=e.replace(u,wpseoMetaboxL10n.sep)).indexOf("%%")&&null!==e.match(/%%[a-z0-9_-]+%%/i))for(var p=e.match(/%%[a-z0-9_-]+%%/gi),i=0;i<p.length;i++)if(void 0===replacedVars[p[i]])e=e.replace(p[i],replacedVars[p[i]]);else{var c=p[i];replacedVars[c]="",ystAjaxReplaceVariables(c,a)}a(e)}}(a,t,function(e){e=ystSanitizeTitle(e),jQuery("#wpseosnippet_title_"+t).html(e);var a=o.html(e).text();s.attr("placeholder",a);var l=document.getElementById("wpseosnippet_title_"+t);null!==l&&(l.scrollWidth>l.clientWidth?n.show():n.hide()),p(t)})},t=function(t){e(!1,t),u(t)};jQuery("#wpglobus-wpseo-tabs").tabs();var a=jQuery("#wpglobus-wpseo-attr"),s=jQuery(".wpseotab.general .form-table"),n=a.data("ids"),o=a.data("names"),l="";n=(n=n+","+a.data("qtip")).split(","),o=o.split(","),jQuery("#wpglobus-wpseo-tabs").insertBefore(s),jQuery(".wpglobus-wpseo-general").each(function(a,r){var p=jQuery(r),i=p.data("language");if(p.html('<table class="form-table wpglobus-table-'+i+'" data-language="'+i+'">'+s.html()+"</table>"),jQuery.each(o,function(e,t){jQuery("#"+t).attr("name",t+"_"+i)}),jQuery.each(n,function(e,t){var a=jQuery("#"+t);"wpseosnippet"==t&&a.addClass("wpglobus-wpseosnippet"),"focuskwresults"==t&&a.addClass("wpglobus-focuskwresults"),wpseoMetaboxL10n.field_prefix+"metadesc"==t&&a.addClass("wpglobus-wpseo_metadesc").text(p.data("metadesc")),wpseoMetaboxL10n.field_prefix+"title"==t&&a.addClass("wpglobus-wpseo_title").val(p.data("wpseotitle")),wpseoMetaboxL10n.field_prefix+"focuskw"==t&&a.addClass("wpglobus-wpseo_focuskw").val(p.data("focuskw")),a.attr("id",t+"_"+i),jQuery("#"+t+"_"+i).attr("data-language",i)}),l="complete"==p.data("permalink")?p.data("url-"+i):p.data("url-"+i)+jQuery("#editable-post-name-full").text()+"/",jQuery("#wpseosnippet_"+i+" .url").text(l),t(i),void 0!==jQuery().autocomplete){var c,d={};jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+i).autocomplete({minLength:3,formatResult:function(e){return jQuery("<div/>").html(e).html()},source:function(e,t){var a=e.term;a in d?t(d[a]):(e._ajax_nonce=wpseoMetaboxL10n.wpseo_keyword_suggest_nonce,e.action="wpseo_get_suggest",c=jQuery.getJSON(ajaxurl,e,function(e,s,n){d[a]=e,n===c&&t(e)}))}})}jQuery("#"+wpseoMetaboxL10n.field_prefix+"title_"+i).keyup(function(){e(!1,jQuery(this).data("language"))}),jQuery("#title_"+i).keyup(function(){var t=jQuery(this).data("language")?jQuery(this).data("language"):WPGlobusAdmin.data.default_language;e(!1,t),u(t)}),0==a&&jQuery("#title").keyup(function(){e(!1,WPGlobusAdmin.data.default_language),u(WPGlobusAdmin.data.default_language)}),0==a&&jQuery("body").on("change","#parent_id",function(){jQuery.each(WPGlobusAdmin.data.enabled_languages,function(t,a){e(!1,a),u(a)})}),jQuery("#"+wpseoMetaboxL10n.field_prefix+"metadesc_"+i).keyup(function(){u(jQuery(this).data("language"))}),jQuery("body").on("keyup","#excerpt-"+i,function(){u(jQuery(this).data("language")?jQuery(this).data("language"):WPGlobusAdmin.data.default_language)}),0==a&&jQuery(".wpglobus-editor").focusout(function(){u(jQuery(this).data("language"))});var g=!1;jQuery(document).on("change","#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+i,function(){var e=jQuery(this).data("language"),a=jQuery("#focuskwhelp_"+e);-1!=jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+e).val().search(",")?(a.click(),g=!0):g&&(a.qtip("hide"),g=!1),t(e)})}),s.addClass("hidden"),jQuery("body").on("change",".wpglobus-wpseo_metadesc",function(e){var t="#"+wpseoMetaboxL10n.field_prefix+"metadesc",a=jQuery(this);jQuery(t).val(WPGlobusCore.getString(jQuery(t).val(),a.val(),a.data("language")))}),jQuery("body").on("change",".wpglobus-wpseo_title",function(e){var t="#"+wpseoMetaboxL10n.field_prefix+"title",a=jQuery(this);jQuery(t).val(WPGlobusCore.getString(jQuery(t).val(),a.val(),a.data("language")))}),jQuery("body").on("change",".wpglobus-wpseo_focuskw",function(e){var t="#"+wpseoMetaboxL10n.field_prefix+"focuskw",a=jQuery(this);jQuery(t).val(WPGlobusCore.getString(jQuery(t).val(),a.val(),a.data("language")))}),jQuery("body").on("click",".wpglobus-post-body-tabs-list li",function(e){jQuery(this).hasClass("wpglobus-post-tab")&&jQuery("#wpglobus-wpseo-tabs").tabs("option","active",jQuery(this).data("order"))}),jQuery(".yoast_help").qtip({content:{attr:"alt"},position:{my:"bottom left",at:"top center"},style:{tip:{corner:!0},classes:"yoast-qtip qtip-rounded qtip-blue"},show:"click",hide:{fixed:!0,delay:500}}),ystUpdateSnippet()}function r(e,t,a){var s,n=ystEscapeFocusKw(jQuery.trim(jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+a).val()));if(""===n)return e;s=-1!==n.search(" ")?n.split(" "):new Array(n);for(var o=0;o<s.length;o++){var l=ystClean(s[o]),r="";t?(l=l.replace(" ","-").toLowerCase(),r=new RegExp("([-/])("+l+")([-/])?")):r=new RegExp("(^|[ \\s\n\r\t\\.,'\\(\"\\+;!?:\\-]+)("+l+")($|[ \\s\n\r\t\\.,'\\)\"\\+;!?:\\-]+)","gim"),void 0!==e&&(e=e.replace(r,"$1<strong>$2</strong>$3"))}return e}function u(e){var t=jQuery.trim(ystClean(jQuery("#"+wpseoMetaboxL10n.field_prefix+"metadesc_"+e).val())),a=jQuery("<div />"),s=jQuery("#wpseosnippet_"+e);if(""===t&&""!==wpseoMetaboxL10n.wpseo_metadesc_template&&(t=wpseoMetaboxL10n.wpseo_metadesc_template),""!==t)t=ystReplaceVariables(t,function(t){t=a.text(t).html(),t=ystClean(t);var n=wpseoMetaboxL10n.wpseo_meta_desc_length-t.length;n=n<0?'<span class="wrong">'+n+"</span>":'<span class="good">'+n+"</span>",jQuery("#"+wpseoMetaboxL10n.field_prefix+"metadesc-length_"+e).html(n),t=r(t=ystSanitizeDesc(t),!1),s.find(".desc span.autogen").html(""),s.find(".desc span.content").html(t),p(e)});else{jQuery("#"+wpseoMetaboxL10n.field_prefix+"metadesc-length_"+e).html(wpseoMetaboxL10n.wpseo_meta_desc_length),s.find(".desc span.content").html(""),p(e);var n="#content";e!=WPGlobusAdmin.data.default_language&&(n="#content_"+e),"undefined"!=typeof tinyMCE&&null!==tinyMCE.get("excerpt-"+e)&&(t=tinyMCE.get("excerpt-"+e).getContent(),t=ystClean(t)),"undefined"!=typeof tinyMCE&&null!==tinyMCE.get(n)&&0===t.length&&(t=tinyMCE.get(n).getContent(),t=ystClean(t));var o=ystEscapeFocusKw(jQuery.trim(jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+e).val()));if(""!==o){var l=new RegExp(o,"gim");t=-1!==t.search(l)&&t.length>wpseoMetaboxL10n.wpseo_meta_desc_length?t.substr(t.search(l),wpseoMetaboxL10n.wpseo_meta_desc_length):t.substr(0,wpseoMetaboxL10n.wpseo_meta_desc_length)}else t=t.substr(0,wpseoMetaboxL10n.wpseo_meta_desc_length);t=r(t,!1),t=ystSanitizeDesc(t),s.find(".desc span.autogen").html(t)}}function p(e){var t=jQuery.trim(jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+e).val());t=ystEscapeFocusKw(t).toLowerCase();var a="#title",s="#content";e!=WPGlobusAdmin.data.default_language&&(a="#title_"+e,s="#content_"+e);var n,o,l=jQuery(document).triggerHandler("wpglobus_post_name_full",{postnamefull:"#editable-post-name-full",language:e})||"#editable-post-name-full";jQuery(l).length&&(n=jQuery(l).text(),o=wpseoMetaboxL10n.wpseo_permalink_template.replace("%postname%",n).replace("http://",""));var r=new RegExp("(^|[ \\s\n\r\t\\.,'\\(\"\\+;!?:\\-])"+ystRemoveLowerCaseDiacritics(t)+"($|[\\s\n\r\t.,'\\)\"\\+!?:;\\-])","gim"),u=ystRemoveLowerCaseDiacritics(t),p=new RegExp(u.replace(/\s+/g,"[-_\\//]"),"gim"),i=jQuery("#focuskwresults_"+e),c=jQuery("#wpseosnippet_"+e).find(".desc span.content").text();if(""!==t){var d="<p>"+wpseoMetaboxL10n.keyword_header+"</p>";d+="<ul>",jQuery(a).length&&(d+="<li>"+wpseoMetaboxL10n.article_header_text+ystFocusKwTest(jQuery(a).val(),r)+"</li>"),d+="<li>"+wpseoMetaboxL10n.page_title_text+ystFocusKwTest(jQuery("#wpseosnippet_title_"+e).text(),r)+"</li>",d+="<li>"+wpseoMetaboxL10n.page_url_text+ystFocusKwTest(o,p)+"</li>",jQuery(s).length&&(d+="<li>"+wpseoMetaboxL10n.content_text+ystFocusKwTest(jQuery(s).val(),r)+"</li>"),d+="<li>"+wpseoMetaboxL10n.meta_description_text+ystFocusKwTest(c,r)+"</li>",d+="</ul>",i.html(d)}else i.html("")}};
1
+ "use strict";var wpglobus_wpseo=function(){if("undefined"!=typeof wpseoMetaboxL10n){var r=function(e,s){var t="",n=jQuery("#"+wpseoMetaboxL10n.field_prefix+"title_"+s),o=jQuery("#"+wpseoMetaboxL10n.field_prefix+"title-length-warning_"+s),l=jQuery("<div />"),a=jQuery("#wpseosnippet_title_"+s);if(n.val()?t=n.val().replace(/(<([^>]+)>)/gi,""):(t=wpseoMetaboxL10n.wpseo_title_template,t=l.html(t).text()),""===t)return a.html(""),void o.hide();t=ystClean(t),t=jQuery.trim(t),t=l.text(t).html(),e&&n.val(t),t=function(e,t,a){if(void 0!==e){if("undefined"==typeof replacedVars&&0==jQuery("#title").size())return e;var s="#title",n="#excerpt-"+t,o="#content";t!=WPGlobusAdmin.data.default_language&&(s="#title_"+t,o="#content_"+t),jQuery(s).length&&(e=e.replace(/%%title%%/g,jQuery(s).val().replace(/(<([^>]+)>)/gi,""))),e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/%%sitedesc%%/g,WPGlobusAdmin.data.blogdescription[t])).replace(/%%sitename%%/g,WPGlobusAdmin.data.blogname[t])).replace(/%%sep%%/g,wpseoMetaboxL10n.sep)).replace(/%%date%%/g,wpseoMetaboxL10n.date)).replace(/%%id%%/g,wpseoMetaboxL10n.id)).replace(/%%page%%/g,wpseoMetaboxL10n.page)).replace(/%%currenttime%%/g,wpseoMetaboxL10n.currenttime)).replace(/%%currentdate%%/g,wpseoMetaboxL10n.currentdate)).replace(/%%currentday%%/g,wpseoMetaboxL10n.currentday)).replace(/%%currentmonth%%/g,wpseoMetaboxL10n.currentmonth)).replace(/%%currentyear%%/g,wpseoMetaboxL10n.currentyear)).replace(/%%focuskw%%/g,jQuery("#yoast_wpseo_focuskw_"+t).val().replace(/(<([^>]+)>)/gi,""));var l="";jQuery(n).length&&(l=ystClean(jQuery(n).val().replace(/(<([^>]+)>)/gi,"")),e=e.replace(/%%excerpt_only%%/g,l)),""===l&&jQuery(o).length&&(l=jQuery(o).val().replace(/(<([^>]+)>)/gi,"").substring(0,wpseoMetaboxL10n.wpseo_meta_desc_length-1)),e=e.replace(/%%excerpt%%/g,l),jQuery("#parent_id").length&&jQuery("#parent_id option:selected").text()!==wpseoMetaboxL10n.no_parent_text&&(e=e.replace(/%%parent_title%%/g,jQuery("#parent_id option:selected").text()));var r=ystEscapeFocusKw(wpseoMetaboxL10n.sep),u=new RegExp(r+" "+r,"g");if(-1!==(e=e.replace(u,wpseoMetaboxL10n.sep)).indexOf("%%")&&null!==e.match(/%%[a-z0-9_-]+%%/i))for(var p=e.match(/%%[a-z0-9_-]+%%/gi),i=0;i<p.length;i++)if(void 0===replacedVars[p[i]])e=e.replace(p[i],replacedVars[p[i]]);else{var c=p[i];replacedVars[c]="",ystAjaxReplaceVariables(c,a)}a(e)}}(t,s,function(e){e=ystSanitizeTitle(e),jQuery("#wpseosnippet_title_"+s).html(e);var t=l.html(e).text();n.attr("placeholder",t);var a=document.getElementById("wpseosnippet_title_"+s);null!==a&&(a.scrollWidth>a.clientWidth?o.show():o.hide()),w(s)})},u=function(e){r(!1,e),y(e)};jQuery("#wpglobus-wpseo-tabs").tabs();var e=jQuery("#wpglobus-wpseo-attr"),p=jQuery(".wpseotab.general .form-table"),i=e.data("ids"),c=e.data("names"),d="";i=(i=i+","+e.data("qtip")).split(","),c=c.split(","),jQuery("#wpglobus-wpseo-tabs").insertBefore(p),jQuery(".wpglobus-wpseo-general").each(function(e,t){var s=jQuery(t),n=s.data("language");if(s.html('<table class="form-table wpglobus-table-'+n+'" data-language="'+n+'">'+p.html()+"</table>"),jQuery.each(c,function(e,t){jQuery("#"+t).attr("name",t+"_"+n)}),jQuery.each(i,function(e,t){var a=jQuery("#"+t);"wpseosnippet"==t&&a.addClass("wpglobus-wpseosnippet"),"focuskwresults"==t&&a.addClass("wpglobus-focuskwresults"),wpseoMetaboxL10n.field_prefix+"metadesc"==t&&a.addClass("wpglobus-wpseo_metadesc").text(s.data("metadesc")),wpseoMetaboxL10n.field_prefix+"title"==t&&a.addClass("wpglobus-wpseo_title").val(s.data("wpseotitle")),wpseoMetaboxL10n.field_prefix+"focuskw"==t&&a.addClass("wpglobus-wpseo_focuskw").val(s.data("focuskw")),a.attr("id",t+"_"+n),jQuery("#"+t+"_"+n).attr("data-language",n)}),d="complete"==s.data("permalink")?s.data("url-"+n):s.data("url-"+n)+jQuery("#editable-post-name-full").text()+"/",jQuery("#wpseosnippet_"+n+" .url").text(d),u(n),void 0!==jQuery().autocomplete){var o,l={};jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+n).autocomplete({minLength:3,formatResult:function(e){return jQuery("<div/>").html(e).html()},source:function(e,s){var n=e.term;n in l?s(l[n]):(e._ajax_nonce=wpseoMetaboxL10n.wpseo_keyword_suggest_nonce,e.action="wpseo_get_suggest",o=jQuery.getJSON(ajaxurl,e,function(e,t,a){l[n]=e,a===o&&s(e)}))}})}jQuery("#"+wpseoMetaboxL10n.field_prefix+"title_"+n).keyup(function(){r(!1,jQuery(this).data("language"))}),jQuery("#title_"+n).keyup(function(){var e=jQuery(this).data("language")?jQuery(this).data("language"):WPGlobusAdmin.data.default_language;r(!1,e),y(e)}),0==e&&jQuery("#title").keyup(function(){r(!1,WPGlobusAdmin.data.default_language),y(WPGlobusAdmin.data.default_language)}),0==e&&jQuery("body").on("change","#parent_id",function(){jQuery.each(WPGlobusAdmin.data.enabled_languages,function(e,t){r(!1,t),y(t)})}),jQuery("#"+wpseoMetaboxL10n.field_prefix+"metadesc_"+n).keyup(function(){y(jQuery(this).data("language"))}),jQuery("body").on("keyup","#excerpt-"+n,function(){y(jQuery(this).data("language")?jQuery(this).data("language"):WPGlobusAdmin.data.default_language)}),0==e&&jQuery(".wpglobus-editor").focusout(function(){y(jQuery(this).data("language"))});var a=!1;jQuery(document).on("change","#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+n,function(){var e=jQuery(this).data("language"),t=jQuery("#focuskwhelp_"+e);-1!=jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+e).val().search(",")?(t.click(),a=!0):a&&(t.qtip("hide"),a=!1),u(e)})}),p.addClass("hidden"),jQuery("body").on("change",".wpglobus-wpseo_metadesc",function(e){var t="#"+wpseoMetaboxL10n.field_prefix+"metadesc",a=jQuery(this);jQuery(t).val(WPGlobusCore.getString(jQuery(t).val(),a.val(),a.data("language")))}),jQuery("body").on("change",".wpglobus-wpseo_title",function(e){var t="#"+wpseoMetaboxL10n.field_prefix+"title",a=jQuery(this);jQuery(t).val(WPGlobusCore.getString(jQuery(t).val(),a.val(),a.data("language")))}),jQuery("body").on("change",".wpglobus-wpseo_focuskw",function(e){var t="#"+wpseoMetaboxL10n.field_prefix+"focuskw",a=jQuery(this);jQuery(t).val(WPGlobusCore.getString(jQuery(t).val(),a.val(),a.data("language")))}),jQuery("body").on("click",".wpglobus-post-body-tabs-list li",function(e){jQuery(this).hasClass("wpglobus-post-tab")&&jQuery("#wpglobus-wpseo-tabs").tabs("option","active",jQuery(this).data("order"))}),jQuery(".yoast_help").qtip({content:{attr:"alt"},position:{my:"bottom left",at:"top center"},style:{tip:{corner:!0},classes:"yoast-qtip qtip-rounded qtip-blue"},show:"click",hide:{fixed:!0,delay:500}}),ystUpdateSnippet()}function g(e,t,a){var s,n=ystEscapeFocusKw(jQuery.trim(jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+a).val()));if(""===n)return e;s=-1!==n.search(" ")?n.split(" "):new Array(n);for(var o=0;o<s.length;o++){var l=ystClean(s[o]),r="";t?(l=l.replace(" ","-").toLowerCase(),r=new RegExp("([-/])("+l+")([-/])?")):r=new RegExp("(^|[ \\s\n\r\t\\.,'\\(\"\\+;!?:\\-]+)("+l+")($|[ \\s\n\r\t\\.,'\\)\"\\+;!?:\\-]+)","gim"),void 0!==e&&(e=e.replace(r,"$1<strong>$2</strong>$3"))}return e}function y(a){var e=jQuery.trim(ystClean(jQuery("#"+wpseoMetaboxL10n.field_prefix+"metadesc_"+a).val())),s=jQuery("<div />"),n=jQuery("#wpseosnippet_"+a);if(""===e&&""!==wpseoMetaboxL10n.wpseo_metadesc_template&&(e=wpseoMetaboxL10n.wpseo_metadesc_template),""!==e)e=ystReplaceVariables(e,function(e){e=s.text(e).html(),e=ystClean(e);var t=wpseoMetaboxL10n.wpseo_meta_desc_length-e.length;t=t<0?'<span class="wrong">'+t+"</span>":'<span class="good">'+t+"</span>",jQuery("#"+wpseoMetaboxL10n.field_prefix+"metadesc-length_"+a).html(t),e=g(e=ystSanitizeDesc(e),!1),n.find(".desc span.autogen").html(""),n.find(".desc span.content").html(e),w(a)});else{jQuery("#"+wpseoMetaboxL10n.field_prefix+"metadesc-length_"+a).html(wpseoMetaboxL10n.wpseo_meta_desc_length),n.find(".desc span.content").html(""),w(a);var t="#content";a!=WPGlobusAdmin.data.default_language&&(t="#content_"+a),"undefined"!=typeof tinyMCE&&null!==tinyMCE.get("excerpt-"+a)&&(e=tinyMCE.get("excerpt-"+a).getContent(),e=ystClean(e)),"undefined"!=typeof tinyMCE&&null!==tinyMCE.get(t)&&0===e.length&&(e=tinyMCE.get(t).getContent(),e=ystClean(e));var o=ystEscapeFocusKw(jQuery.trim(jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+a).val()));if(""!==o){var l=new RegExp(o,"gim");e=-1!==e.search(l)&&e.length>wpseoMetaboxL10n.wpseo_meta_desc_length?e.substr(e.search(l),wpseoMetaboxL10n.wpseo_meta_desc_length):e.substr(0,wpseoMetaboxL10n.wpseo_meta_desc_length)}else e=e.substr(0,wpseoMetaboxL10n.wpseo_meta_desc_length);e=g(e,!1),e=ystSanitizeDesc(e),n.find(".desc span.autogen").html(e)}}function w(e){var t=jQuery.trim(jQuery("#"+wpseoMetaboxL10n.field_prefix+"focuskw_"+e).val());t=ystEscapeFocusKw(t).toLowerCase();var a,s,n="#title",o="#content";e!=WPGlobusAdmin.data.default_language&&(n="#title_"+e,o="#content_"+e);var l=jQuery(document).triggerHandler("wpglobus_post_name_full",{postnamefull:"#editable-post-name-full",language:e})||"#editable-post-name-full";jQuery(l).length&&(a=jQuery(l).text(),s=wpseoMetaboxL10n.wpseo_permalink_template.replace("%postname%",a).replace("http://",""));var r=new RegExp("(^|[ \\s\n\r\t\\.,'\\(\"\\+;!?:\\-])"+ystRemoveLowerCaseDiacritics(t)+"($|[\\s\n\r\t.,'\\)\"\\+!?:;\\-])","gim"),u=ystRemoveLowerCaseDiacritics(t),p=new RegExp(u.replace(/\s+/g,"[-_\\//]"),"gim"),i=jQuery("#focuskwresults_"+e),c=jQuery("#wpseosnippet_"+e).find(".desc span.content").text();if(""!==t){var d="<p>"+wpseoMetaboxL10n.keyword_header+"</p>";d+="<ul>",jQuery(n).length&&(d+="<li>"+wpseoMetaboxL10n.article_header_text+ystFocusKwTest(jQuery(n).val(),r)+"</li>"),d+="<li>"+wpseoMetaboxL10n.page_title_text+ystFocusKwTest(jQuery("#wpseosnippet_title_"+e).text(),r)+"</li>",d+="<li>"+wpseoMetaboxL10n.page_url_text+ystFocusKwTest(s,p)+"</li>",jQuery(o).length&&(d+="<li>"+wpseoMetaboxL10n.content_text+ystFocusKwTest(jQuery(o).val(),r)+"</li>"),d+="<li>"+wpseoMetaboxL10n.meta_description_text+ystFocusKwTest(c,r)+"</li>",d+="</ul>",i.html(d)}else i.html("")}};
includes/js/wpglobus-yoastseo-30.min.js CHANGED
@@ -1 +1 @@
1
- var WPGlobusYoastSeo;jQuery(document).ready(function(e){"use strict";if("undefined"!=typeof wpseoReplaceVarsL10n&&"undefined"!=typeof WPGlobusCoreData){var t;if("edit-tags.php"==WPGlobusVendor.pagenow){t=WPGlobusYoastSeo={editorIDs:["description"],editor:{},submitId:"#submit",preventChangeEditor:!1,observer:null,init:function(){t.attachListeners(),_.delay(t.start,1500)},submit:function(a){"mouseenter"===a.type?e.each(t.editor,function(a,o){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(t.editor[a].content):tinymce.get(a).setContent(t.editor[a].content)}):"mouseleave"===a.type?t.preventChangeEditor||(e.each(t.editor,function(a,o){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(WPGlobusCore.TextFilter(o.content,t.getCurrentTab(),"RETURN_EMPTY")):tinymce.get(a).setContent(WPGlobusCore.TextFilter(o.content,t.getCurrentTab(),"RETURN_EMPTY"))}),t.preventChangeEditor=!1):"click"===a.type&&(t.preventChangeEditor=!0,"tinymce"!=getUserSetting("editor")&&setUserSetting("editor","tinymce"))},attachListeners:function(){e(".wrap").on("tabsactivate",function(a,o){e.each(t.editor,function(a,s){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(WPGlobusCore.TextFilter(s.content,o.newTab[0].dataset.language,"RETURN_EMPTY")):tinymce.get(a).setContent(WPGlobusCore.TextFilter(s.content,o.newTab[0].dataset.language,"RETURN_EMPTY"))})}),e(document).on("mouseenter",t.submitId,t.submit).on("mouseleave",t.submitId,t.submit).on("click",t.submitId,t.submit),e(document).on("tinymce-editor-init",function(a,o){if(-1!=_.indexOf(t.editorIDs,o.id)){var s=e("#"+o.id);t.editor[o.id]={},t.editor[o.id].contentEditor=o,t.editor[o.id].content=s.val(),o.setContent(WPGlobusCore.TextFilter(t.editor[o.id].content,WPGlobusCoreData.default_language,"RETURN_EMPTY")),e("#"+o.getContainer().id).find("iframe").addClass("wpglobus-translatable"),s.removeClass("hidden"),o.on("nodechange keyup",_.debounce(t.update,500)),s.on("input keyup",_.debounce(t.update,500))}})},update:function(a){var o,s;void 0!==a.target&&("tinymce"==(o=a.target.id)&&(o=a.target.dataset.id),void 0!==t.editor[o].contentEditor&&(s=!t.editor[o].contentEditor||t.editor[o].contentEditor.isHidden()?e("#"+o).val():t.editor[o].contentEditor.getContent({format:"raw"}),t.editor[o].content=WPGlobusCore.getString(t.editor[o].content,s,t.getCurrentTab())))},getCurrentTab:function(){return e(".wpglobus-taxonomy-tabs-list .ui-tabs-active").data("language")},start:function(){e(".wpglobus-element_description").css({display:"none"})}},WPGlobusYoastSeo.init();var a=function(){e(".wrap").on("tabsactivate",function(t,a){a.newTab[0].dataset.language==WPGlobusCoreData.default_language?e("#poststuff .inside").css({display:"block"}):e("#poststuff .inside").css({display:"none"})}),e.each(["category_description","sitedesc","sitename","tag_description","term_description","term_title"],function(e,t){wpseoReplaceVarsL10n.replace_vars[t]=WPGlobusCore.TextFilter(wpseoReplaceVarsL10n.replace_vars[t],WPGlobusCoreData.default_language)}),WPGlobusYoastSeo.observer=new MutationObserver(function(t){t.forEach(function(t){if("placeholder"==t.attributeName){WPGlobusYoastSeo.observer.disconnect();var a=e("#wpseo_focuskw");""==a.val()&&a.attr("placeholder",WPGlobusCore.TextFilter(a.attr("placeholder"),WPGlobusCoreData.default_language)),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})}})}),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})};window.WPGlobusYoastSeoPlugin=new a}else{t=WPGlobusYoastSeo={wpseoTabSelector:"#wpglobus-wpseo-tabs",url:"",attrs:e("#wpglobus-wpseo-attr"),iB:e("#wpseo-meta-section-content"),t:e("#wpseo-meta-section-content"),ids:"",names:"",init:function(){t.start()},initAddKeywordPopup:function(){1===e("#wpseo-add-keyword-popup").length&&e(".wpseo-add-keyword").on("click",t.addKeywordPopup)},addKeywordPopup:function(){var t=e("#wpseo-add-keyword-popup").find("h3").html();tb_show(t,"#TB_inline?width=650&height=350&inlineId=wpseo-add-keyword-popup","group"),jQuery("#TB_window").css("height",235),jQuery("#TB_window").css("width",680)},qtip:function(){e(".yoast_help").qtip({content:{attr:"alt"},position:{my:"bottom left",at:"top center"},style:{tip:{corner:!0},classes:"yoast-qtip qtip-rounded qtip-blue"},show:"click",hide:{fixed:!0,delay:500}})},start:function(){e(t.wpseoTabSelector).tabs(),t.ids=t.attrs.data("ids"),t.names=t.attrs.data("names"),t.ids=t.ids+","+t.attrs.data("qtip"),t.ids=t.ids.split(","),t.names=t.names.split(","),e("#wpglobus-wpseo-tabs").insertBefore(t.iB),e(".wpseo-metabox-tabs").css({height:"26px"}),e(".wpglobus-wpseo-general").each(function(a,o){var s=e(o),i=s.data("language"),n="wpseo-meta-section-content_"+i;s.html('<div id="'+n+'" class="wpseo-meta-section wpglobus-wpseo-meta-section" style="width:100%" data-language="'+i+'">'+t.t.html()+"</div>"),e("#"+n+" .wpseo-metabox-tabs").attr("id","wpseo-metabox-tabs_"+i),e("#"+n+" .wpseotab").attr("id","wpseo_content_"+i),e("#"+n).css({display:"block"}),e("#wpseo_meta").css({overflow:"hidden"}),e("#"+n+" .snippet_container").addClass("wpglobus-snippet_container"),i!==WPGlobusCoreData.default_language&&e("#"+n+" .wpseo-add-keyword").addClass("hidden"),e.each(t.names,function(t,a){e("#"+a).attr("name",a+"_"+i)}),e.each(t.ids,function(t,a){var o=e("#"+a);"wpseosnippet"==a&&o.addClass("wpglobus-wpseosnippet"),"snippet_title"==a&&o.addClass("wpglobus-snippet_title"),"snippet_meta"==a&&o.addClass("wpglobus-snippet_meta"),"snippet_cite"==a&&o.addClass("wpglobus-snippet_cite"),"snippet_citeBase"==a&&o.addClass("wpglobus-snippet_citeBase"),"yoast_wpseo_focuskw_text_input"==a&&o.addClass("wpglobus-yoast_wpseo_focuskw_text_input"),"wpseo-pageanalysis"==a&&o.addClass("wpglobus-wpseo-pageanalysis"),"snippet_preview"==a&&o.addClass("wpglobus-snippet_preview"),o.attr("id",a+"_"+i),e("#"+a+"_"+i).attr("data-language",i)});var r=WPGlobusCore.TextFilter(e("#yoast_wpseo_focuskw_text_input").val(),i,"RETURN_EMPTY");e("#yoast_wpseo_focuskw_text_input_"+i).val(r),e("#yoast_wpseo_focuskw_"+i).val(r),i!==WPGlobusCoreData.default_language&&(e("#"+n+" #yoast_wpseo_focuskw_text_input_"+i).addClass("hidden").after('<div class="wpglobus-suggest" style="font-weight:bold;">'+WPGlobusVendor.i18n.yoastseo_plus_access+"</div>"),e("#"+n+" #wpseo-pageanalysis_"+i).addClass("hidden"))}),t.iB.addClass("hidden"),t.iB.css({height:0,overflow:"hidden"});var a=WPGlobusCore.TextFilter(e("#yoast_wpseo_focuskw_text_input").val(),WPGlobusCoreData.default_language,"RETURN_EMPTY");e("#yoast_wpseo_focuskw_text_input").val(a),e("#yoast_wpseo_focuskw").val(a),e(".wpseo-metabox-sidebar .wpseo-meta-section-link").on("click",function(t){"#wpseo-meta-section-content"==e(this).attr("href")?e("#wpglobus-wpseo-tabs").css({display:"block"}):e("#wpglobus-wpseo-tabs").css({display:"none"})}),e("body").on("click",".wpglobus-post-body-tabs-list li",function(t){var a=e(this);if(a.hasClass("wpglobus-post-tab")){e("#wpglobus-wpseo-tabs").tabs("option","active",a.data("order"));var o=e("#yoast_wpseo_focuskw_text_input_"+e(this).data("language")).val();YoastSEO.app.rawData.keyword=o,e("#yoast_wpseo_focuskw_text_input").val(o),e('input[name="yoast_wpseo_focuskw"]').val(o),YoastSEO.app.analyzeTimer(YoastSEO.app)}}),t.qtip(),t.initAddKeywordPopup()}};var o;(a=function(){this.replaceVars=wpseoReplaceVarsL10n.replace_vars,this.language=WPGlobusCoreData.default_language,this.tab=WPGlobusCoreData.default_language,this.wpseoTab=WPGlobusCoreData.default_language,this.title_template=wpseoPostScraperL10n.title_template,this.focuskw=e("#yoast_wpseo_focuskw_text_input"),this.focuskw_hidden=e('input[name="yoast_wpseo_focuskw"]'),this.focuskwKeep=!1,this.post_slug="#editable-post-name-full",YoastSEO.app.registerPlugin("wpglobusYoastSeoPlugin",{status:"ready"}),YoastSEO.app.registerModification("content",this.contentModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("title",this.titleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_title",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_meta",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_page_title",this.pageTitleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_meta_desc",this.metaDescModification,"wpglobusYoastSeoPlugin",0),e(document).on("blur",".wpglobus-snippet_title",function(t){var a=e(this),o=WPGlobusCore.getString(e("#yoast_wpseo_title").val(),a.text(),a.data("language"));YoastSEO.app.rawData.pageTitle=o,e('input[name="yoast_wpseo_title"]').val(o),e("#snippet_title").text(o)}),e(document).on("blur",".wpglobus-snippet_meta",function(t){var a=e(this),o=WPGlobusCore.getString(e("#yoast_wpseo_metadesc").val(),a.text(),a.data("language"));e("#yoast_wpseo_metadesc").val(o),e("#snippet_meta").text(o)}),e(document).on("keyup",".wpglobus-yoast_wpseo_focuskw_text_input",function(t){var a=e(this),s=a.val();o.focuskw.val(s),o.focuskw_hidden.val(s),o.updateWpseoKeyword(s,a.data("language")),YoastSEO.app.analyzeTimer(YoastSEO.app)}),e("#publish,#save-post").on("mouseenter",function(t){var a,s="";e(".wpglobus-yoast_wpseo_focuskw_text_input").each(function(t,o){a=e(this),s=WPGlobusCore.getString(s,a.val(),a.data("language"))}),o.focuskw.val(s),o.focuskw_hidden.val(s)}).on("mouseleave",function(t){if(!o.focuskwKeep){o.wpseoTab=e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");e(this);o.focuskw.val(e("#yoast_wpseo_focuskw_text_input_"+o.wpseoTab).val()),o.focuskw_hidden.val(e("#yoast_wpseo_focuskw_text_input_"+o.wpseoTab).val())}}).on("click",function(e){o.focuskwKeep=!0}),e(WPGlobusYoastSeo.wpseoTabSelector).on("tabsactivate",function(t,a){if(a.newPanel.attr("data-language")===WPGlobusCoreData.default_language){WPGlobusYoastSeo.url=e(o.post_slug).text();var s=e("#yoast_wpseo_focuskw_text_input_"+WPGlobusCoreData.default_language).val();YoastSEO.app.rawData.keyword=s,o.focuskw.val(s),o.focuskw_hidden.val(s),YoastSEO.app.analyzeTimer(YoastSEO.app)}}),o=this}).prototype.getWPseoTab=function(){return e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language")},a.prototype.citeModification=function(t){var a="#snippet_citeBase_"+t,o="#snippet_cite_"+t,s=e("#wpseo-tab-"+t).data("yoast-cite-base");!1===e("#wpseo-tab-"+t).data("cite-contenteditable")&&e(o).attr("contenteditable","false"),e(a).text(s)},a.prototype.pageTitleModification=function(t){var a,s="",i="";return o.title_template==t?e.each(WPGlobusCoreData.enabled_languages,function(a,n){o.language=n,s=o.replaceVariablesPlugin(t),e("#snippet_title_"+n).text(s),n==o.getWPseoTab()&&(i=s)}):(a=WPGlobusCore.getTranslations(t),e.each(WPGlobusCoreData.enabled_languages,function(t,n){o.language=n,s=""===a[n]?o.replaceVariablesPlugin(o.title_template):a[n],e("#snippet_title_"+n).text(s),n==o.getWPseoTab()&&(i=s)})),i},a.prototype.metaDescModification=function(t){return e.each(WPGlobusCoreData.enabled_languages,function(a,s){e("#snippet_meta_"+s).text(WPGlobusCore.TextFilter(t,s,"RETURN_EMPTY")),o.citeModification(s)}),WPGlobusCore.TextFilter(t,o.getWPseoTab(),"RETURN_EMPTY")},a.prototype.snippetModification=function(e){return WPGlobusCore.TextFilter(e,o.getWPseoTab(),"RETURN_EMPTY")},a.prototype.contentModification=function(t){return o.getWPseoTab()==WPGlobusCoreData.default_language?t:e("#content_"+o.getWPseoTab()).val()},a.prototype.titleModification=function(t){return setTimeout(o.updatePageAnalysis,1e3),o.getWPseoTab()==WPGlobusCoreData.default_language?t:e("#title_"+o.getWPseoTab()).val()},a.prototype.defaultReplace=function(e){return e.replace(/%%sitedesc%%/g,this.replaceVars.sitedesc).replace(/%%sitename%%/g,WPGlobusCore.TextFilter(this.replaceVars.sitename,this.language)).replace(/%%term_title%%/g,this.replaceVars.term_title).replace(/%%term_description%%/g,this.replaceVars.term_description).replace(/%%category_description%%/g,this.replaceVars.category_description).replace(/%%tag_description%%/g,this.replaceVars.tag_description).replace(/%%searchphrase%%/g,this.replaceVars.searchphrase).replace(/%%sep%%/g,this.replaceVars.sep).replace(/%%date%%/g,this.replaceVars.date).replace(/%%id%%/g,this.replaceVars.id).replace(/%%page%%/g,this.replaceVars.page).replace(/%%currenttime%%/g,this.replaceVars.currenttime).replace(/%%currentdate%%/g,this.replaceVars.currentdate).replace(/%%currentday%%/g,this.replaceVars.currentday).replace(/%%currentmonth%%/g,this.replaceVars.currentmonth).replace(/%%currentyear%%/g,this.replaceVars.currentyear).replace(/%%focuskw%%/g,YoastSEO.app.stringHelper.stripAllTags(YoastSEO.app.rawData.keyword))},a.prototype.replaceVariablesPlugin=function(e){return void 0!==e&&(e=this.titleReplace(e),e=this.defaultReplace(e),e=this.doubleSepReplace(e)),e},a.prototype.titleReplace=function(t){var a="";return void 0===(a=this.language==WPGlobusCoreData.default_language?e("#title").val():e("#title_"+this.language).val())&&(a=YoastSEO.app.rawData.pageTitle),t=t.replace(/%%title%%/g,a)},a.prototype.doubleSepReplace=function(e){var t=YoastSEO.app.stringHelper.addEscapeChars(this.replaceVars.sep),a=new RegExp(t+" "+t,"g");return e=e.replace(a,this.replaceVars.sep)},a.prototype.updateWpseoKeyword=function(t,a){a!=WPGlobusCoreData.default_language&&(1==e("#wpseo-meta-section-content_"+a+" .wpseo_keyword").length&&e("#wpseo-meta-section-content_"+a+" .wpseo_keyword").removeClass("wpseo_keyword").addClass("wpglobus-wpseo_keyword_"+a),e(".wpglobus-wpseo_keyword_"+a).text(t))},a.prototype.updatePageAnalysis=function(){e("#wpseo-pageanalysis_"+o.getWPseoTab()).html(e("#wpseo-pageanalysis").html())},window.WPGlobusYoastSeoPlugin=new a,YoastSEO.Analyzer.prototype.urlKeyword=function(){var e=[{test:"urlKeyword",result:0}];return void 0!==WPGlobusYoastSeo&&""!==WPGlobusYoastSeo.url&&(this.config.url=WPGlobusYoastSeo.url),void 0!==this.config.url&&(e[0].result=this.stringHelper.countMatches(this.config.url,this.keywordRegexInverse)),e}}}});
1
+ var WPGlobusYoastSeo;jQuery(document).ready(function(r){"use strict";var n;if("undefined"!=typeof wpseoReplaceVarsL10n&&"undefined"!=typeof WPGlobusCoreData)if("edit-tags.php"==WPGlobusVendor.pagenow){n=WPGlobusYoastSeo={editorIDs:["description"],editor:{},submitId:"#submit",preventChangeEditor:!1,observer:null,init:function(){n.attachListeners(),_.delay(n.start,1500)},submit:function(e){"mouseenter"===e.type?r.each(n.editor,function(e,t){!n.editor[e].contentEditor||n.editor[e].contentEditor.isHidden()?r("#"+e).val(n.editor[e].content):tinymce.get(e).setContent(n.editor[e].content)}):"mouseleave"===e.type?n.preventChangeEditor||(r.each(n.editor,function(e,t){!n.editor[e].contentEditor||n.editor[e].contentEditor.isHidden()?r("#"+e).val(WPGlobusCore.TextFilter(t.content,n.getCurrentTab(),"RETURN_EMPTY")):tinymce.get(e).setContent(WPGlobusCore.TextFilter(t.content,n.getCurrentTab(),"RETURN_EMPTY"))}),n.preventChangeEditor=!1):"click"===e.type&&(n.preventChangeEditor=!0,"tinymce"!=getUserSetting("editor")&&setUserSetting("editor","tinymce"))},attachListeners:function(){r(".wrap").on("tabsactivate",function(e,a){r.each(n.editor,function(e,t){!n.editor[e].contentEditor||n.editor[e].contentEditor.isHidden()?r("#"+e).val(WPGlobusCore.TextFilter(t.content,a.newTab[0].dataset.language,"RETURN_EMPTY")):tinymce.get(e).setContent(WPGlobusCore.TextFilter(t.content,a.newTab[0].dataset.language,"RETURN_EMPTY"))})}),r(document).on("mouseenter",n.submitId,n.submit).on("mouseleave",n.submitId,n.submit).on("click",n.submitId,n.submit),r(document).on("tinymce-editor-init",function(e,t){if(-1!=_.indexOf(n.editorIDs,t.id)){var a=r("#"+t.id);n.editor[t.id]={},n.editor[t.id].contentEditor=t,n.editor[t.id].content=a.val(),t.setContent(WPGlobusCore.TextFilter(n.editor[t.id].content,WPGlobusCoreData.default_language,"RETURN_EMPTY")),r("#"+t.getContainer().id).find("iframe").addClass("wpglobus-translatable"),a.removeClass("hidden"),t.on("nodechange keyup",_.debounce(n.update,500)),a.on("input keyup",_.debounce(n.update,500))}})},update:function(e){var t,a;void 0!==e.target&&("tinymce"==(t=e.target.id)&&(t=e.target.dataset.id),void 0!==n.editor[t].contentEditor&&(a=!n.editor[t].contentEditor||n.editor[t].contentEditor.isHidden()?r("#"+t).val():n.editor[t].contentEditor.getContent({format:"raw"}),n.editor[t].content=WPGlobusCore.getString(n.editor[t].content,a,n.getCurrentTab())))},getCurrentTab:function(){return r(".wpglobus-taxonomy-tabs-list .ui-tabs-active").data("language")},start:function(){r(".wpglobus-element_description").css({display:"none"})}},WPGlobusYoastSeo.init();var e=function(){r(".wrap").on("tabsactivate",function(e,t){t.newTab[0].dataset.language==WPGlobusCoreData.default_language?r("#poststuff .inside").css({display:"block"}):r("#poststuff .inside").css({display:"none"})}),r.each(["category_description","sitedesc","sitename","tag_description","term_description","term_title"],function(e,t){wpseoReplaceVarsL10n.replace_vars[t]=WPGlobusCore.TextFilter(wpseoReplaceVarsL10n.replace_vars[t],WPGlobusCoreData.default_language)}),WPGlobusYoastSeo.observer=new MutationObserver(function(e){e.forEach(function(e){if("placeholder"==e.attributeName){WPGlobusYoastSeo.observer.disconnect();var t=r("#wpseo_focuskw");""==t.val()&&t.attr("placeholder",WPGlobusCore.TextFilter(t.attr("placeholder"),WPGlobusCoreData.default_language)),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})}})}),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})};window.WPGlobusYoastSeoPlugin=new e}else{var p;n=WPGlobusYoastSeo={wpseoTabSelector:"#wpglobus-wpseo-tabs",url:"",attrs:r("#wpglobus-wpseo-attr"),iB:r("#wpseo-meta-section-content"),t:r("#wpseo-meta-section-content"),ids:"",names:"",init:function(){n.start()},initAddKeywordPopup:function(){1===r("#wpseo-add-keyword-popup").length&&r(".wpseo-add-keyword").on("click",n.addKeywordPopup)},addKeywordPopup:function(){var e=r("#wpseo-add-keyword-popup").find("h3").html();tb_show(e,"#TB_inline?width=650&height=350&inlineId=wpseo-add-keyword-popup","group"),jQuery("#TB_window").css("height",235),jQuery("#TB_window").css("width",680)},qtip:function(){r(".yoast_help").qtip({content:{attr:"alt"},position:{my:"bottom left",at:"top center"},style:{tip:{corner:!0},classes:"yoast-qtip qtip-rounded qtip-blue"},show:"click",hide:{fixed:!0,delay:500}})},start:function(){r(n.wpseoTabSelector).tabs(),n.ids=n.attrs.data("ids"),n.names=n.attrs.data("names"),n.ids=n.ids+","+n.attrs.data("qtip"),n.ids=n.ids.split(","),n.names=n.names.split(","),r("#wpglobus-wpseo-tabs").insertBefore(n.iB),r(".wpseo-metabox-tabs").css({height:"26px"}),r(".wpglobus-wpseo-general").each(function(e,t){var a=r(t),o=a.data("language"),s="wpseo-meta-section-content_"+o;a.html('<div id="'+s+'" class="wpseo-meta-section wpglobus-wpseo-meta-section" style="width:100%" data-language="'+o+'">'+n.t.html()+"</div>"),r("#"+s+" .wpseo-metabox-tabs").attr("id","wpseo-metabox-tabs_"+o),r("#"+s+" .wpseotab").attr("id","wpseo_content_"+o),r("#"+s).css({display:"block"}),r("#wpseo_meta").css({overflow:"hidden"}),r("#"+s+" .snippet_container").addClass("wpglobus-snippet_container"),o!==WPGlobusCoreData.default_language&&r("#"+s+" .wpseo-add-keyword").addClass("hidden"),r.each(n.names,function(e,t){r("#"+t).attr("name",t+"_"+o)}),r.each(n.ids,function(e,t){var a=r("#"+t);"wpseosnippet"==t&&a.addClass("wpglobus-wpseosnippet"),"snippet_title"==t&&a.addClass("wpglobus-snippet_title"),"snippet_meta"==t&&a.addClass("wpglobus-snippet_meta"),"snippet_cite"==t&&a.addClass("wpglobus-snippet_cite"),"snippet_citeBase"==t&&a.addClass("wpglobus-snippet_citeBase"),"yoast_wpseo_focuskw_text_input"==t&&a.addClass("wpglobus-yoast_wpseo_focuskw_text_input"),"wpseo-pageanalysis"==t&&a.addClass("wpglobus-wpseo-pageanalysis"),"snippet_preview"==t&&a.addClass("wpglobus-snippet_preview"),a.attr("id",t+"_"+o),r("#"+t+"_"+o).attr("data-language",o)});var i=WPGlobusCore.TextFilter(r("#yoast_wpseo_focuskw_text_input").val(),o,"RETURN_EMPTY");r("#yoast_wpseo_focuskw_text_input_"+o).val(i),r("#yoast_wpseo_focuskw_"+o).val(i),o!==WPGlobusCoreData.default_language&&(r("#"+s+" #yoast_wpseo_focuskw_text_input_"+o).addClass("hidden").after('<div class="wpglobus-suggest" style="font-weight:bold;">'+WPGlobusVendor.i18n.yoastseo_plus_access+"</div>"),r("#"+s+" #wpseo-pageanalysis_"+o).addClass("hidden"))}),n.iB.addClass("hidden"),n.iB.css({height:0,overflow:"hidden"});var e=WPGlobusCore.TextFilter(r("#yoast_wpseo_focuskw_text_input").val(),WPGlobusCoreData.default_language,"RETURN_EMPTY");r("#yoast_wpseo_focuskw_text_input").val(e),r("#yoast_wpseo_focuskw").val(e),r(".wpseo-metabox-sidebar .wpseo-meta-section-link").on("click",function(e){"#wpseo-meta-section-content"==r(this).attr("href")?r("#wpglobus-wpseo-tabs").css({display:"block"}):r("#wpglobus-wpseo-tabs").css({display:"none"})}),r("body").on("click",".wpglobus-post-body-tabs-list li",function(e){var t=r(this);if(t.hasClass("wpglobus-post-tab")){r("#wpglobus-wpseo-tabs").tabs("option","active",t.data("order"));var a=r("#yoast_wpseo_focuskw_text_input_"+r(this).data("language")).val();YoastSEO.app.rawData.keyword=a,r("#yoast_wpseo_focuskw_text_input").val(a),r('input[name="yoast_wpseo_focuskw"]').val(a),YoastSEO.app.analyzeTimer(YoastSEO.app)}}),n.qtip(),n.initAddKeywordPopup()}},(e=function(){this.replaceVars=wpseoReplaceVarsL10n.replace_vars,this.language=WPGlobusCoreData.default_language,this.tab=WPGlobusCoreData.default_language,this.wpseoTab=WPGlobusCoreData.default_language,this.title_template=wpseoPostScraperL10n.title_template,this.focuskw=r("#yoast_wpseo_focuskw_text_input"),this.focuskw_hidden=r('input[name="yoast_wpseo_focuskw"]'),this.focuskwKeep=!1,this.post_slug="#editable-post-name-full",YoastSEO.app.registerPlugin("wpglobusYoastSeoPlugin",{status:"ready"}),YoastSEO.app.registerModification("content",this.contentModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("title",this.titleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_title",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_meta",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_page_title",this.pageTitleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_meta_desc",this.metaDescModification,"wpglobusYoastSeoPlugin",0),r(document).on("blur",".wpglobus-snippet_title",function(e){var t=r(this),a=WPGlobusCore.getString(r("#yoast_wpseo_title").val(),t.text(),t.data("language"));YoastSEO.app.rawData.pageTitle=a,r('input[name="yoast_wpseo_title"]').val(a),r("#snippet_title").text(a)}),r(document).on("blur",".wpglobus-snippet_meta",function(e){var t=r(this),a=WPGlobusCore.getString(r("#yoast_wpseo_metadesc").val(),t.text(),t.data("language"));r("#yoast_wpseo_metadesc").val(a),r("#snippet_meta").text(a)}),r(document).on("keyup",".wpglobus-yoast_wpseo_focuskw_text_input",function(e){var t=r(this),a=t.val();p.focuskw.val(a),p.focuskw_hidden.val(a),p.updateWpseoKeyword(a,t.data("language")),YoastSEO.app.analyzeTimer(YoastSEO.app)}),r("#publish,#save-post").on("mouseenter",function(e){var a,o="";r(".wpglobus-yoast_wpseo_focuskw_text_input").each(function(e,t){a=r(this),o=WPGlobusCore.getString(o,a.val(),a.data("language"))}),p.focuskw.val(o),p.focuskw_hidden.val(o)}).on("mouseleave",function(e){if(!p.focuskwKeep){p.wpseoTab=r(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");r(this);p.focuskw.val(r("#yoast_wpseo_focuskw_text_input_"+p.wpseoTab).val()),p.focuskw_hidden.val(r("#yoast_wpseo_focuskw_text_input_"+p.wpseoTab).val())}}).on("click",function(e){p.focuskwKeep=!0}),r(WPGlobusYoastSeo.wpseoTabSelector).on("tabsactivate",function(e,t){if(t.newPanel.attr("data-language")===WPGlobusCoreData.default_language){WPGlobusYoastSeo.url=r(p.post_slug).text();var a=r("#yoast_wpseo_focuskw_text_input_"+WPGlobusCoreData.default_language).val();YoastSEO.app.rawData.keyword=a,p.focuskw.val(a),p.focuskw_hidden.val(a),YoastSEO.app.analyzeTimer(YoastSEO.app)}}),p=this}).prototype.getWPseoTab=function(){return r(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language")},e.prototype.citeModification=function(e){var t="#snippet_citeBase_"+e,a="#snippet_cite_"+e,o=r("#wpseo-tab-"+e).data("yoast-cite-base");!1===r("#wpseo-tab-"+e).data("cite-contenteditable")&&r(a).attr("contenteditable","false"),r(t).text(o)},e.prototype.pageTitleModification=function(a){var o,s="#snippet_title_",i="",n="";return p.title_template==a?r.each(WPGlobusCoreData.enabled_languages,function(e,t){p.language=t,i=p.replaceVariablesPlugin(a),r(s+t).text(i),t==p.getWPseoTab()&&(n=i)}):(o=WPGlobusCore.getTranslations(a),r.each(WPGlobusCoreData.enabled_languages,function(e,t){p.language=t,i=""===o[t]?p.replaceVariablesPlugin(p.title_template):o[t],r(s+t).text(i),t==p.getWPseoTab()&&(n=i)})),n},e.prototype.metaDescModification=function(a){return r.each(WPGlobusCoreData.enabled_languages,function(e,t){r("#snippet_meta_"+t).text(WPGlobusCore.TextFilter(a,t,"RETURN_EMPTY")),p.citeModification(t)}),WPGlobusCore.TextFilter(a,p.getWPseoTab(),"RETURN_EMPTY")},e.prototype.snippetModification=function(e){return WPGlobusCore.TextFilter(e,p.getWPseoTab(),"RETURN_EMPTY")},e.prototype.contentModification=function(e){return p.getWPseoTab()==WPGlobusCoreData.default_language?e:r("#content_"+p.getWPseoTab()).val()},e.prototype.titleModification=function(e){return setTimeout(p.updatePageAnalysis,1e3),p.getWPseoTab()==WPGlobusCoreData.default_language?e:r("#title_"+p.getWPseoTab()).val()},e.prototype.defaultReplace=function(e){return e.replace(/%%sitedesc%%/g,this.replaceVars.sitedesc).replace(/%%sitename%%/g,WPGlobusCore.TextFilter(this.replaceVars.sitename,this.language)).replace(/%%term_title%%/g,this.replaceVars.term_title).replace(/%%term_description%%/g,this.replaceVars.term_description).replace(/%%category_description%%/g,this.replaceVars.category_description).replace(/%%tag_description%%/g,this.replaceVars.tag_description).replace(/%%searchphrase%%/g,this.replaceVars.searchphrase).replace(/%%sep%%/g,this.replaceVars.sep).replace(/%%date%%/g,this.replaceVars.date).replace(/%%id%%/g,this.replaceVars.id).replace(/%%page%%/g,this.replaceVars.page).replace(/%%currenttime%%/g,this.replaceVars.currenttime).replace(/%%currentdate%%/g,this.replaceVars.currentdate).replace(/%%currentday%%/g,this.replaceVars.currentday).replace(/%%currentmonth%%/g,this.replaceVars.currentmonth).replace(/%%currentyear%%/g,this.replaceVars.currentyear).replace(/%%focuskw%%/g,YoastSEO.app.stringHelper.stripAllTags(YoastSEO.app.rawData.keyword))},e.prototype.replaceVariablesPlugin=function(e){return void 0!==e&&(e=this.titleReplace(e),e=this.defaultReplace(e),e=this.doubleSepReplace(e)),e},e.prototype.titleReplace=function(e){var t="";return void 0===(t=this.language==WPGlobusCoreData.default_language?r("#title").val():r("#title_"+this.language).val())&&(t=YoastSEO.app.rawData.pageTitle),e=e.replace(/%%title%%/g,t)},e.prototype.doubleSepReplace=function(e){var t=YoastSEO.app.stringHelper.addEscapeChars(this.replaceVars.sep),a=new RegExp(t+" "+t,"g");return e=e.replace(a,this.replaceVars.sep)},e.prototype.updateWpseoKeyword=function(e,t){t!=WPGlobusCoreData.default_language&&(1==r("#wpseo-meta-section-content_"+t+" .wpseo_keyword").length&&r("#wpseo-meta-section-content_"+t+" .wpseo_keyword").removeClass("wpseo_keyword").addClass("wpglobus-wpseo_keyword_"+t),r(".wpglobus-wpseo_keyword_"+t).text(e))},e.prototype.updatePageAnalysis=function(){r("#wpseo-pageanalysis_"+p.getWPseoTab()).html(r("#wpseo-pageanalysis").html())},window.WPGlobusYoastSeoPlugin=new e,YoastSEO.Analyzer.prototype.urlKeyword=function(){var e=[{test:"urlKeyword",result:0}];return void 0!==WPGlobusYoastSeo&&""!==WPGlobusYoastSeo.url&&(this.config.url=WPGlobusYoastSeo.url),void 0!==this.config.url&&(e[0].result=this.stringHelper.countMatches(this.config.url,this.keywordRegexInverse)),e}}});
includes/js/wpglobus-yoastseo-31.min.js CHANGED
@@ -1 +1 @@
1
- var WPGlobusYoastSeo;jQuery(document).ready(function(e){"use strict";if("undefined"!=typeof wpseoReplaceVarsL10n&&"undefined"!=typeof WPGlobusCoreData&&"undefined"!=typeof WPGlobusVendor){var t;if("edit-tags.php"==WPGlobusVendor.pagenow||"term.php"==WPGlobusVendor.pagenow){t=WPGlobusYoastSeo={editorIDs:["description"],editor:{},submitId:"#submit",preventChangeEditor:!1,observer:null,init:function(){t.attachListeners(),_.delay(t.start,1500)},submit:function(a){"mouseenter"===a.type?e.each(t.editor,function(a,s){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(t.editor[a].content):tinymce.get(a).setContent(t.editor[a].content)}):"mouseleave"===a.type?t.preventChangeEditor||(e.each(t.editor,function(a,s){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(WPGlobusCore.TextFilter(s.content,t.getCurrentTab(),"RETURN_EMPTY")):tinymce.get(a).setContent(WPGlobusCore.TextFilter(s.content,t.getCurrentTab(),"RETURN_EMPTY"))}),t.preventChangeEditor=!1):"click"===a.type&&(t.preventChangeEditor=!0,"tinymce"!=getUserSetting("editor")&&setUserSetting("editor","tinymce"))},attachListeners:function(){e(".wrap").on("tabsactivate",function(a,s){e.each(t.editor,function(a,o){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(WPGlobusCore.TextFilter(o.content,s.newTab[0].dataset.language,"RETURN_EMPTY")):tinymce.get(a).setContent(WPGlobusCore.TextFilter(o.content,s.newTab[0].dataset.language,"RETURN_EMPTY"))})}),e(document).on("mouseenter",t.submitId,t.submit).on("mouseleave",t.submitId,t.submit).on("click",t.submitId,t.submit),e(document).on("tinymce-editor-init",function(a,s){if(-1!=_.indexOf(t.editorIDs,s.id)){var o=e("#"+s.id);t.editor[s.id]={},t.editor[s.id].contentEditor=s,t.editor[s.id].content=o.val(),s.setContent(WPGlobusCore.TextFilter(t.editor[s.id].content,WPGlobusCoreData.default_language,"RETURN_EMPTY")),e("#"+s.getContainer().id).find("iframe").addClass("wpglobus-translatable"),o.removeClass("hidden"),s.on("nodechange keyup",_.debounce(t.update,500)),o.on("input keyup",_.debounce(t.update,500))}})},update:function(a){var s,o;void 0!==a.target&&("tinymce"==(s=a.target.id)&&(s=a.target.dataset.id),void 0!==t.editor[s].contentEditor&&(o=!t.editor[s].contentEditor||t.editor[s].contentEditor.isHidden()?e("#"+s).val():t.editor[s].contentEditor.getContent({format:"raw"}),t.editor[s].content=WPGlobusCore.getString(t.editor[s].content,o,t.getCurrentTab())))},getCurrentTab:function(){return e(".wpglobus-taxonomy-tabs-list .ui-tabs-active").data("language")},start:function(){e(".wpglobus-element_description").css({display:"none"})}},WPGlobusYoastSeo.init();var a=function(){e(".wrap").on("tabsactivate",function(t,a){a.newTab[0].dataset.language==WPGlobusCoreData.default_language?e("#poststuff .inside").css({display:"block"}):e("#poststuff .inside").css({display:"none"})}),e.each(["category_description","sitedesc","sitename","tag_description","term_description","term_title"],function(e,t){wpseoReplaceVarsL10n.replace_vars[t]=WPGlobusCore.TextFilter(wpseoReplaceVarsL10n.replace_vars[t],WPGlobusCoreData.default_language)}),WPGlobusYoastSeo.observer=new MutationObserver(function(t){t.forEach(function(t){if("placeholder"==t.attributeName){WPGlobusYoastSeo.observer.disconnect();var a=e("#wpseo_focuskw");""==a.val()&&a.attr("placeholder",WPGlobusCore.TextFilter(a.attr("placeholder"),WPGlobusCoreData.default_language)),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})}})}),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})};window.WPGlobusYoastSeoPlugin=new a}else{t=WPGlobusYoastSeo={wpseoTabSelector:"#wpglobus-wpseo-tabs",url:"",attrs:e("#wpglobus-wpseo-attr"),iB:e("#wpseo-meta-section-content"),t:e("#wpseo-meta-section-content"),ids:"",names:"",editSnippetButtonClass:"wpglobus-snippet-editor__edit-button",editSnippetFormClass:"wpglobus-snippet-editor__form",editSnippetSubmitClass:"wpglobus-snippet-editor__submit",editSnippetHeadingClass:"wpglobus-snippet-editor__heading-editor",yoastTitleProgress:"wpglobus-yoast-title-progress",yoastMetadescProgress:"wpglobus-yoast-metadesc-progress",init:function(){t.start()},initAddKeywordPopup:function(){1===e("#wpseo-add-keyword-popup").length&&e(".wpseo-add-keyword").on("click",t.addKeywordPopup)},addKeywordPopup:function(){var t=e("#wpseo-add-keyword-popup").find("h3").html();tb_show(t,"#TB_inline?width=650&height=350&inlineId=wpseo-add-keyword-popup","group"),jQuery("#TB_window").css("height",235),jQuery("#TB_window").css("width",680)},qtip:function(){e(".yoast_help").qtip({content:{attr:"alt"},position:{my:"bottom left",at:"top center"},style:{tip:{corner:!0},classes:"yoast-qtip qtip-rounded qtip-blue"},show:"click",hide:{fixed:!0,delay:500}})},removeClasses:function(e,t){_.each(t,function(t){e.removeClass(t)})},updateProgressBar:function(a,s){if(void 0!==a&&(void 0!==s||("undefined"!==a.data("language")&&(s=a.data("language")),void 0!==s))){var o,i=["snippet-editor__progress--bad","snippet-editor__progress--ok","snippet-editor__progress--good"],n=0,p="",r=0,l=!1;n=a.val().length,a.hasClass("wpglobus-snippet-editor-title")?(r=(o=e("progress."+t.yoastTitleProgress+"_"+s)).attr("max"),p=i[2],0==n?p=i[1]:n>r?(p=i[1],l=!0):n>0&&n<35&&(p=i[1])):a.hasClass("wpglobus-snippet-editor-meta-description")&&(r=(o=e("progress."+t.yoastMetadescProgress+"_"+s)).attr("max"),p=i[2],0==n?p=i[1]:n>r?(p=i[1],l=!0):n>0&&n<121&&(p=i[1])),t.removeClasses(o,i),o.attr("value",n).addClass(p),l?a.css("color","#f00"):a.css("color","#000")}},start:function(){e(t.wpseoTabSelector).tabs(),t.ids=t.attrs.data("ids"),t.names=t.attrs.data("names"),t.ids=t.ids+","+t.attrs.data("qtip"),t.ids=t.ids.split(","),t.names=t.names.split(","),e("#wpglobus-wpseo-tabs").insertBefore(t.iB),e(".wpseo-metabox-tabs").css({height:"26px"}),e(".wpglobus-wpseo-general").each(function(a,s){var o=e(s),i=o.data("language"),n="wpseo-meta-section-content_"+i;o.html('<div id="'+n+'" class="wpseo-meta-section wpglobus-wpseo-meta-section" style="width:100%" data-language="'+i+'">'+t.t.html()+"</div>"),e("#"+n+" .wpseo-metabox-tabs").attr("id","wpseo-metabox-tabs_"+i),e("#"+n+" .wpseotab").attr("id","wpseo_content_"+i),e("#"+n).css({display:"block"}),e("#wpseo_meta").css({overflow:"hidden"}),e("#"+n+" .snippet_container").addClass("wpglobus-snippet_container"),i!==WPGlobusCoreData.default_language&&e("#"+n+" .wpseo-add-keyword").addClass("hidden"),e.each(t.names,function(t,a){e("#"+a).attr("name",a+"_"+i)}),e.each(t.ids,function(a,s){var o=e("#"+s);"wpseosnippet"==s&&o.addClass("wpglobus-wpseosnippet"),"snippet_title"==s&&o.addClass("wpglobus-snippet_title"),"snippet_meta"==s&&o.addClass("wpglobus-snippet_meta"),"snippet_cite"==s&&o.addClass("wpglobus-snippet_cite"),"snippet_citeBase"==s&&o.addClass("wpglobus-snippet_citeBase"),"yoast_wpseo_focuskw_text_input"==s&&o.addClass("wpglobus-yoast_wpseo_focuskw_text_input"),"wpseo-pageanalysis"==s&&o.addClass("wpglobus-wpseo-pageanalysis"),"snippet_preview"==s&&o.addClass("wpglobus-snippet_preview"),"snippet-editor-title"==s&&(o.addClass("wpglobus-snippet-editor-title"),o.parent("label").attr("for",o.parent("label").attr("for")+"_"+i),o.val(e("#wpseo-tab-"+i).data("wpseotitle")),o.parent("label").find("progress").addClass(t.yoastTitleProgress).addClass(t.yoastTitleProgress+"_"+i),_.debounce(t.updateProgressBar(o,i),500)),"snippet-editor-slug"==s&&(o.addClass("wpglobus-snippet-editor-slug"),o.parent("label").attr("for",o.parent("label").attr("for")+"_"+i),WPGlobusCoreData.default_language!=i&&o.attr("disabled","disabled")),"snippet-editor-meta-description"==s&&(o.addClass("wpglobus-snippet-editor-meta-description"),o.parent("label").attr("for",o.parent("label").attr("for")+"_"+i),o.val(e("#wpseo-tab-"+i).data("metadesc")),o.parent("label").find("progress").addClass(t.yoastMetadescProgress).addClass(t.yoastMetadescProgress+"_"+i),_.debounce(t.updateProgressBar(o,i),500)),o.attr("id",s+"_"+i),e("#"+s+"_"+i).attr("data-language",i)});var p=WPGlobusCore.TextFilter(e("#yoast_wpseo_focuskw_text_input").val(),i,"RETURN_EMPTY");e("#yoast_wpseo_focuskw_text_input_"+i).val(p),e("#yoast_wpseo_focuskw_"+i).val(p),i!==WPGlobusCoreData.default_language&&(e("#"+n+" #yoast_wpseo_focuskw_text_input_"+i).addClass("hidden").after('<div class="wpglobus-suggest" style="font-weight:bold;">'+WPGlobusVendor.i18n.yoastseo_plus_access+"</div>"),e("#"+n+" #wpseo-pageanalysis_"+i).addClass("hidden"))}),e(".wpglobus-wpseosnippet").each(function(a,s){var o=e(s),i=o.data("language");o.find("button.snippet-editor__button.snippet-editor__edit-button").addClass(t.editSnippetButtonClass).addClass(t.editSnippetButtonClass+"_"+i).attr("data-language",i),o.find(".snippet-editor__form").addClass(t.editSnippetFormClass).addClass(t.editSnippetFormClass+"_"+i),o.find(".snippet-editor__heading-editor").addClass(t.editSnippetHeadingClass).addClass(t.editSnippetHeadingClass+"_"+i),o.find(".snippet-editor__submit").addClass(t.editSnippetSubmitClass).addClass(t.editSnippetSubmitClass+"_"+i).attr("data-language",i)}),t.iB.addClass("hidden"),t.iB.css({height:0,overflow:"hidden"});var a=WPGlobusCore.TextFilter(e("#yoast_wpseo_focuskw_text_input").val(),WPGlobusCoreData.default_language,"RETURN_EMPTY");e("#yoast_wpseo_focuskw_text_input").val(a),e("#yoast_wpseo_focuskw").val(a),e(".wpseo-metabox-sidebar .wpseo-meta-section-link").on("click",function(t){"#wpseo-meta-section-content"==e(this).attr("href")?e("#wpglobus-wpseo-tabs").css({display:"block"}):e("#wpglobus-wpseo-tabs").css({display:"none"})}),e("body").on("click","."+t.editSnippetButtonClass,function(a){var s=e(this),o=s.data("language"),i=e("."+t.editSnippetFormClass+"_"+o),n=e("."+t.editSnippetSubmitClass+"_"+o),p=e("."+t.editSnippetHeadingClass+"_"+o);i.hasClass("snippet-editor--hidden")?(i.removeClass("snippet-editor--hidden"),p.removeClass("snippet-editor--hidden"),n.removeClass("snippet-editor--hidden")):(i.addClass("snippet-editor--hidden"),p.addClass("snippet-editor--hidden")),s.addClass("snippet-editor--hidden")}),e("body").on("click","."+t.editSnippetSubmitClass,function(a){var s=e(this).data("language"),o=e("."+t.editSnippetButtonClass+"_"+s),i=e("."+t.editSnippetFormClass+"_"+s),n=e("."+t.editSnippetSubmitClass+"_"+s),p=e("."+t.editSnippetHeadingClass+"_"+s);o.removeClass("snippet-editor--hidden"),i.addClass("snippet-editor--hidden"),n.addClass("snippet-editor--hidden"),p.addClass("snippet-editor--hidden")}),e(document).on("keyup","input.wpglobus-snippet-editor-title",function(a){var s=e(this),o=s.data("language"),i=WPGlobusCore.getString(e('input[name="yoast_wpseo_title"]').val(),s.val(),o);e("#snippet_title_"+o).text(s.val()),YoastSEO.app.rawData.pageTitle=i,e('input[name="yoast_wpseo_title"]').val(i),e("#snippet_title").text(i),_.debounce(t.updateProgressBar(s,o),500)}),e(document).on("keyup","input.wpglobus-snippet-editor-slug",function(t){var a=e(this),s=a.data("language");e("#snippet_cite_"+s).text(a.val()+"/"),e("#editable-post-name").text(a.val()),e("#editable-post-name-full").text(a.val())}),e(document).on("change","input.wpglobus-snippet-editor-slug",function(t){var a=e(this);e.post(ajaxurl,{action:"sample-permalink",post_id:e("#post_ID").val()||0,new_slug:a.val(),new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()})}),e(document).on("keyup","textarea.wpglobus-snippet-editor-meta-description",function(a){var s=e(this),o=s.data("language");e("#snippet_meta_"+o).text(s.val());var i=WPGlobusCore.getString(e("#yoast_wpseo_metadesc").val(),s.val(),s.data("language"));e("#yoast_wpseo_metadesc").val(i),e("#snippet_meta").text(i),_.debounce(t.updateProgressBar(s,o),500)}),e("body").on("click",".wpglobus-post-body-tabs-list li",function(t){var a=e(this);if(a.hasClass("wpglobus-post-tab")){e("#wpglobus-wpseo-tabs").tabs("option","active",a.data("order"));var s=e("#yoast_wpseo_focuskw_text_input_"+e(this).data("language")).val();YoastSEO.app.rawData.keyword=s,e("#yoast_wpseo_focuskw_text_input").val(s),e('input[name="yoast_wpseo_focuskw"]').val(s),YoastSEO.app.analyzeTimer(YoastSEO.app)}}),t.qtip(),t.initAddKeywordPopup()}};var s;(a=function(){this.replaceVars=wpseoReplaceVarsL10n.replace_vars,this.language=WPGlobusCoreData.default_language,this.tab=WPGlobusCoreData.default_language,this.wpseoTab=WPGlobusCoreData.default_language,this.title_template=wpseoPostScraperL10n.title_template,this.focuskw=e("#yoast_wpseo_focuskw_text_input"),this.focuskw_hidden=e('input[name="yoast_wpseo_focuskw"]'),this.focuskwKeep=!1,this.post_slug="#editable-post-name-full",YoastSEO.app.registerPlugin("wpglobusYoastSeoPlugin",{status:"ready"}),YoastSEO.app.registerModification("content",this.contentModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("title",this.titleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_title",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_meta",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_page_title",this.pageTitleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_meta_desc",this.metaDescModification,"wpglobusYoastSeoPlugin",0),e(document).on("blur",".wpglobus-snippet_title",function(t){var a=e(this),s=WPGlobusCore.getString(e("#yoast_wpseo_title").val(),a.text(),a.data("language"));YoastSEO.app.rawData.pageTitle=s,e('input[name="yoast_wpseo_title"]').val(s),e("#snippet_title").text(s)}),e(document).on("blur",".wpglobus-snippet_meta",function(t){var a=e(this),s=WPGlobusCore.getString(e("#yoast_wpseo_metadesc").val(),a.text(),a.data("language"));e("#yoast_wpseo_metadesc").val(s),e("#snippet_meta").text(s)}),e(document).on("keyup",".wpglobus-yoast_wpseo_focuskw_text_input",function(t){var a=e(this),o=a.val();s.focuskw.val(o),s.focuskw_hidden.val(o),s.updateWpseoKeyword(o,a.data("language")),YoastSEO.app.analyzeTimer(YoastSEO.app)}),e("#publish,#save-post").on("mouseenter",function(t){var a,o="";e(".wpglobus-yoast_wpseo_focuskw_text_input").each(function(t,s){a=e(this),o=WPGlobusCore.getString(o,a.val(),a.data("language"))}),s.focuskw.val(o),s.focuskw_hidden.val(o)}).on("mouseleave",function(t){if(!s.focuskwKeep){s.wpseoTab=e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");e(this);s.focuskw.val(e("#yoast_wpseo_focuskw_text_input_"+s.wpseoTab).val()),s.focuskw_hidden.val(e("#yoast_wpseo_focuskw_text_input_"+s.wpseoTab).val())}}).on("click",function(e){s.focuskwKeep=!0}),e(WPGlobusYoastSeo.wpseoTabSelector).on("tabsactivate",function(t,a){if(a.newPanel.attr("data-language")===WPGlobusCoreData.default_language){WPGlobusYoastSeo.url=e(s.post_slug).text();var o=e("#yoast_wpseo_focuskw_text_input_"+WPGlobusCoreData.default_language).val();YoastSEO.app.rawData.keyword=o,s.focuskw.val(o),s.focuskw_hidden.val(o),YoastSEO.app.analyzeTimer(YoastSEO.app)}}),s=this}).prototype.getWPseoTab=function(){return e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language")},a.prototype.citeModification=function(t){var a="#snippet_citeBase_"+t,s="#snippet_cite_"+t,o=e("#wpseo-tab-"+t).data("yoast-cite-base");!1===e("#wpseo-tab-"+t).data("cite-contenteditable")&&e(s).attr("contenteditable","false"),e(a).text(o)},a.prototype.pageTitleModification=function(t){var a,o="#snippet_title_",i="",n="";if(s.title_template==t)e.each(WPGlobusCoreData.enabled_languages,function(a,p){s.language=p,i=s.replaceVariablesPlugin(t),e(o+p).text(i),p==s.getWPseoTab()&&(n=i)});else{if(a=WPGlobusCore.getTranslations(t),s.getWPseoTab()!==WPGlobusCoreData.default_language&&a[WPGlobusCoreData.default_language]==t){var p=s.getWPseoTab();return e(o+p).text(t),t}e.each(WPGlobusCoreData.enabled_languages,function(t,p){s.language=p,i=""===a[p]?s.replaceVariablesPlugin(s.title_template):a[p],e(o+p).text(i),p==s.getWPseoTab()&&(n=i)})}return n},a.prototype.metaDescModification=function(t){if(s.getWPseoTab()!==WPGlobusCoreData.default_language){if(WPGlobusCore.getTranslations(t)[WPGlobusCoreData.default_language]==t){var a=s.getWPseoTab();return e("#snippet_meta_"+a).text(t),s.citeModification(a),t}}return e.each(WPGlobusCoreData.enabled_languages,function(a,o){e("#snippet_meta_"+o).text(WPGlobusCore.TextFilter(t,o,"RETURN_EMPTY")),s.citeModification(o)}),WPGlobusCore.TextFilter(t,s.getWPseoTab(),"RETURN_EMPTY")},a.prototype.snippetModification=function(e){return WPGlobusCore.TextFilter(e,s.getWPseoTab(),"RETURN_EMPTY")},a.prototype.contentModification=function(t){return s.getWPseoTab()==WPGlobusCoreData.default_language?t:e("#content_"+s.getWPseoTab()).val()},a.prototype.titleModification=function(t){return setTimeout(s.updatePageAnalysis,1e3),s.getWPseoTab()==WPGlobusCoreData.default_language?t:e("#title_"+s.getWPseoTab()).val()},a.prototype.defaultReplace=function(e){var t=YoastSEO.app.rawData.keyword;return e.replace(/%%sitedesc%%/g,this.replaceVars.sitedesc).replace(/%%sitename%%/g,this.replaceVars.sitename).replace(/%%term_title%%/g,this.replaceVars.term_title).replace(/%%term_description%%/g,this.replaceVars.term_description).replace(/%%category_description%%/g,this.replaceVars.category_description).replace(/%%tag_description%%/g,this.replaceVars.tag_description).replace(/%%searchphrase%%/g,this.replaceVars.searchphrase).replace(/%%date%%/g,this.replaceVars.date).replace(/%%id%%/g,this.replaceVars.id).replace(/%%page%%/g,this.replaceVars.page).replace(/%%currenttime%%/g,this.replaceVars.currenttime).replace(/%%currentdate%%/g,this.replaceVars.currentdate).replace(/%%currentday%%/g,this.replaceVars.currentday).replace(/%%currentmonth%%/g,this.replaceVars.currentmonth).replace(/%%currentyear%%/g,this.replaceVars.currentyear).replace(/%%focuskw%%/g,t)},a.prototype.replaceVariablesPlugin=function(e){return void 0!==e&&(e=this.titleReplace(e),e=this.defaultReplace(e),e=this.replaceSeparators(e)),e},a.prototype.replaceSeparators=function(e){return e.replace(/%%sep%%(\s+%%sep%%)*/g,this.replaceVars.sep)},a.prototype.titleReplace=function(t){var a="";return void 0===(a=this.language==WPGlobusCoreData.default_language?e("#title").val():e("#title_"+this.language).val())&&(a=YoastSEO.app.rawData.pageTitle),t=t.replace(/%%title%%/g,a)},a.prototype.doubleSepReplace=function(e){var t=YoastSEO.app.stringHelper.addEscapeChars(this.replaceVars.sep),a=new RegExp(t+" "+t,"g");return e=e.replace(a,this.replaceVars.sep)},a.prototype.updateWpseoKeyword=function(t,a){a!=WPGlobusCoreData.default_language&&(1==e("#wpseo-meta-section-content_"+a+" .wpseo_keyword").length&&e("#wpseo-meta-section-content_"+a+" .wpseo_keyword").removeClass("wpseo_keyword").addClass("wpglobus-wpseo_keyword_"+a),e(".wpglobus-wpseo_keyword_"+a).text(t))},a.prototype.updatePageAnalysis=function(){e("#wpseo-pageanalysis_"+s.getWPseoTab()).html(e("#wpseo-pageanalysis").html())},a.prototype.countMatches=function(e,t){return null!==e.match(t)?e.match.length:0},window.WPGlobusYoastSeoPlugin=new a,YoastSEO.Analyzer.prototype.urlKeyword=function(){var e=[{test:"urlKeyword",result:0}];return void 0!==WPGlobusYoastSeo&&""!==WPGlobusYoastSeo.url&&(this.config.url=WPGlobusYoastSeo.url),void 0!==this.config.url&&(e[0].result=a.prototype.countMatches(this.config.url,this.keywordRegexInverse)),e}}}});
1
+ var WPGlobusYoastSeo;jQuery(document).ready(function(r){"use strict";var l;if("undefined"!=typeof wpseoReplaceVarsL10n&&("undefined"!=typeof WPGlobusCoreData&&"undefined"!=typeof WPGlobusVendor))if("edit-tags.php"==WPGlobusVendor.pagenow||"term.php"==WPGlobusVendor.pagenow){l=WPGlobusYoastSeo={editorIDs:["description"],editor:{},submitId:"#submit",preventChangeEditor:!1,observer:null,init:function(){l.attachListeners(),_.delay(l.start,1500)},submit:function(e){"mouseenter"===e.type?r.each(l.editor,function(e,t){!l.editor[e].contentEditor||l.editor[e].contentEditor.isHidden()?r("#"+e).val(l.editor[e].content):tinymce.get(e).setContent(l.editor[e].content)}):"mouseleave"===e.type?l.preventChangeEditor||(r.each(l.editor,function(e,t){!l.editor[e].contentEditor||l.editor[e].contentEditor.isHidden()?r("#"+e).val(WPGlobusCore.TextFilter(t.content,l.getCurrentTab(),"RETURN_EMPTY")):tinymce.get(e).setContent(WPGlobusCore.TextFilter(t.content,l.getCurrentTab(),"RETURN_EMPTY"))}),l.preventChangeEditor=!1):"click"===e.type&&(l.preventChangeEditor=!0,"tinymce"!=getUserSetting("editor")&&setUserSetting("editor","tinymce"))},attachListeners:function(){r(".wrap").on("tabsactivate",function(e,a){r.each(l.editor,function(e,t){!l.editor[e].contentEditor||l.editor[e].contentEditor.isHidden()?r("#"+e).val(WPGlobusCore.TextFilter(t.content,a.newTab[0].dataset.language,"RETURN_EMPTY")):tinymce.get(e).setContent(WPGlobusCore.TextFilter(t.content,a.newTab[0].dataset.language,"RETURN_EMPTY"))})}),r(document).on("mouseenter",l.submitId,l.submit).on("mouseleave",l.submitId,l.submit).on("click",l.submitId,l.submit),r(document).on("tinymce-editor-init",function(e,t){if(-1!=_.indexOf(l.editorIDs,t.id)){var a=r("#"+t.id);l.editor[t.id]={},l.editor[t.id].contentEditor=t,l.editor[t.id].content=a.val(),t.setContent(WPGlobusCore.TextFilter(l.editor[t.id].content,WPGlobusCoreData.default_language,"RETURN_EMPTY")),r("#"+t.getContainer().id).find("iframe").addClass("wpglobus-translatable"),a.removeClass("hidden"),t.on("nodechange keyup",_.debounce(l.update,500)),a.on("input keyup",_.debounce(l.update,500))}})},update:function(e){var t,a;void 0!==e.target&&("tinymce"==(t=e.target.id)&&(t=e.target.dataset.id),void 0!==l.editor[t].contentEditor&&(a=!l.editor[t].contentEditor||l.editor[t].contentEditor.isHidden()?r("#"+t).val():l.editor[t].contentEditor.getContent({format:"raw"}),l.editor[t].content=WPGlobusCore.getString(l.editor[t].content,a,l.getCurrentTab())))},getCurrentTab:function(){return r(".wpglobus-taxonomy-tabs-list .ui-tabs-active").data("language")},start:function(){r(".wpglobus-element_description").css({display:"none"})}},WPGlobusYoastSeo.init();var t=function(){r(".wrap").on("tabsactivate",function(e,t){t.newTab[0].dataset.language==WPGlobusCoreData.default_language?r("#poststuff .inside").css({display:"block"}):r("#poststuff .inside").css({display:"none"})}),r.each(["category_description","sitedesc","sitename","tag_description","term_description","term_title"],function(e,t){wpseoReplaceVarsL10n.replace_vars[t]=WPGlobusCore.TextFilter(wpseoReplaceVarsL10n.replace_vars[t],WPGlobusCoreData.default_language)}),WPGlobusYoastSeo.observer=new MutationObserver(function(e){e.forEach(function(e){if("placeholder"==e.attributeName){WPGlobusYoastSeo.observer.disconnect();var t=r("#wpseo_focuskw");""==t.val()&&t.attr("placeholder",WPGlobusCore.TextFilter(t.attr("placeholder"),WPGlobusCoreData.default_language)),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})}})}),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})};window.WPGlobusYoastSeoPlugin=new t}else{var p;l=WPGlobusYoastSeo={wpseoTabSelector:"#wpglobus-wpseo-tabs",url:"",attrs:r("#wpglobus-wpseo-attr"),iB:r("#wpseo-meta-section-content"),t:r("#wpseo-meta-section-content"),ids:"",names:"",editSnippetButtonClass:"wpglobus-snippet-editor__edit-button",editSnippetFormClass:"wpglobus-snippet-editor__form",editSnippetSubmitClass:"wpglobus-snippet-editor__submit",editSnippetHeadingClass:"wpglobus-snippet-editor__heading-editor",yoastTitleProgress:"wpglobus-yoast-title-progress",yoastMetadescProgress:"wpglobus-yoast-metadesc-progress",init:function(){l.start()},initAddKeywordPopup:function(){1===r("#wpseo-add-keyword-popup").length&&r(".wpseo-add-keyword").on("click",l.addKeywordPopup)},addKeywordPopup:function(){var e=r("#wpseo-add-keyword-popup").find("h3").html();tb_show(e,"#TB_inline?width=650&height=350&inlineId=wpseo-add-keyword-popup","group"),jQuery("#TB_window").css("height",235),jQuery("#TB_window").css("width",680)},qtip:function(){r(".yoast_help").qtip({content:{attr:"alt"},position:{my:"bottom left",at:"top center"},style:{tip:{corner:!0},classes:"yoast-qtip qtip-rounded qtip-blue"},show:"click",hide:{fixed:!0,delay:500}})},removeClasses:function(t,e){_.each(e,function(e){t.removeClass(e)})},updateProgressBar:function(e,t){if(void 0!==e&&(void 0!==t||("undefined"!==e.data("language")&&(t=e.data("language")),void 0!==t))){var a,s,o=["snippet-editor__progress--bad","snippet-editor__progress--ok","snippet-editor__progress--good"],i="",n=0,p=!1;s=e.val().length,e.hasClass("wpglobus-snippet-editor-title")?(n=(a=r("progress."+l.yoastTitleProgress+"_"+t)).attr("max"),i=o[2],0==s?i=o[1]:n<s?(i=o[1],p=!0):0<s&&s<35&&(i=o[1])):e.hasClass("wpglobus-snippet-editor-meta-description")&&(n=(a=r("progress."+l.yoastMetadescProgress+"_"+t)).attr("max"),i=o[2],0==s?i=o[1]:n<s?(i=o[1],p=!0):0<s&&s<121&&(i=o[1])),l.removeClasses(a,o),a.attr("value",s).addClass(i),p?e.css("color","#f00"):e.css("color","#000")}},start:function(){r(l.wpseoTabSelector).tabs(),l.ids=l.attrs.data("ids"),l.names=l.attrs.data("names"),l.ids=l.ids+","+l.attrs.data("qtip"),l.ids=l.ids.split(","),l.names=l.names.split(","),r("#wpglobus-wpseo-tabs").insertBefore(l.iB),r(".wpseo-metabox-tabs").css({height:"26px"}),r(".wpglobus-wpseo-general").each(function(e,t){var a=r(t),s=a.data("language"),o="wpseo-meta-section-content_"+s;a.html('<div id="'+o+'" class="wpseo-meta-section wpglobus-wpseo-meta-section" style="width:100%" data-language="'+s+'">'+l.t.html()+"</div>"),r("#"+o+" .wpseo-metabox-tabs").attr("id","wpseo-metabox-tabs_"+s),r("#"+o+" .wpseotab").attr("id","wpseo_content_"+s),r("#"+o).css({display:"block"}),r("#wpseo_meta").css({overflow:"hidden"}),r("#"+o+" .snippet_container").addClass("wpglobus-snippet_container"),s!==WPGlobusCoreData.default_language&&r("#"+o+" .wpseo-add-keyword").addClass("hidden"),r.each(l.names,function(e,t){r("#"+t).attr("name",t+"_"+s)}),r.each(l.ids,function(e,t){var a=r("#"+t);"wpseosnippet"==t&&a.addClass("wpglobus-wpseosnippet"),"snippet_title"==t&&a.addClass("wpglobus-snippet_title"),"snippet_meta"==t&&a.addClass("wpglobus-snippet_meta"),"snippet_cite"==t&&a.addClass("wpglobus-snippet_cite"),"snippet_citeBase"==t&&a.addClass("wpglobus-snippet_citeBase"),"yoast_wpseo_focuskw_text_input"==t&&a.addClass("wpglobus-yoast_wpseo_focuskw_text_input"),"wpseo-pageanalysis"==t&&a.addClass("wpglobus-wpseo-pageanalysis"),"snippet_preview"==t&&a.addClass("wpglobus-snippet_preview"),"snippet-editor-title"==t&&(a.addClass("wpglobus-snippet-editor-title"),a.parent("label").attr("for",a.parent("label").attr("for")+"_"+s),a.val(r("#wpseo-tab-"+s).data("wpseotitle")),a.parent("label").find("progress").addClass(l.yoastTitleProgress).addClass(l.yoastTitleProgress+"_"+s),_.debounce(l.updateProgressBar(a,s),500)),"snippet-editor-slug"==t&&(a.addClass("wpglobus-snippet-editor-slug"),a.parent("label").attr("for",a.parent("label").attr("for")+"_"+s),WPGlobusCoreData.default_language!=s&&a.attr("disabled","disabled")),"snippet-editor-meta-description"==t&&(a.addClass("wpglobus-snippet-editor-meta-description"),a.parent("label").attr("for",a.parent("label").attr("for")+"_"+s),a.val(r("#wpseo-tab-"+s).data("metadesc")),a.parent("label").find("progress").addClass(l.yoastMetadescProgress).addClass(l.yoastMetadescProgress+"_"+s),_.debounce(l.updateProgressBar(a,s),500)),a.attr("id",t+"_"+s),r("#"+t+"_"+s).attr("data-language",s)});var i=WPGlobusCore.TextFilter(r("#yoast_wpseo_focuskw_text_input").val(),s,"RETURN_EMPTY");r("#yoast_wpseo_focuskw_text_input_"+s).val(i),r("#yoast_wpseo_focuskw_"+s).val(i),s!==WPGlobusCoreData.default_language&&(r("#"+o+" #yoast_wpseo_focuskw_text_input_"+s).addClass("hidden").after('<div class="wpglobus-suggest" style="font-weight:bold;">'+WPGlobusVendor.i18n.yoastseo_plus_access+"</div>"),r("#"+o+" #wpseo-pageanalysis_"+s).addClass("hidden"))}),r(".wpglobus-wpseosnippet").each(function(e,t){var a=r(t),s=a.data("language");a.find("button.snippet-editor__button.snippet-editor__edit-button").addClass(l.editSnippetButtonClass).addClass(l.editSnippetButtonClass+"_"+s).attr("data-language",s),a.find(".snippet-editor__form").addClass(l.editSnippetFormClass).addClass(l.editSnippetFormClass+"_"+s),a.find(".snippet-editor__heading-editor").addClass(l.editSnippetHeadingClass).addClass(l.editSnippetHeadingClass+"_"+s),a.find(".snippet-editor__submit").addClass(l.editSnippetSubmitClass).addClass(l.editSnippetSubmitClass+"_"+s).attr("data-language",s)}),l.iB.addClass("hidden"),l.iB.css({height:0,overflow:"hidden"});var e=WPGlobusCore.TextFilter(r("#yoast_wpseo_focuskw_text_input").val(),WPGlobusCoreData.default_language,"RETURN_EMPTY");r("#yoast_wpseo_focuskw_text_input").val(e),r("#yoast_wpseo_focuskw").val(e),r(".wpseo-metabox-sidebar .wpseo-meta-section-link").on("click",function(e){"#wpseo-meta-section-content"==r(this).attr("href")?r("#wpglobus-wpseo-tabs").css({display:"block"}):r("#wpglobus-wpseo-tabs").css({display:"none"})}),r("body").on("click","."+l.editSnippetButtonClass,function(e){var t=r(this),a=t.data("language"),s=r("."+l.editSnippetFormClass+"_"+a),o=r("."+l.editSnippetSubmitClass+"_"+a),i=r("."+l.editSnippetHeadingClass+"_"+a);s.hasClass("snippet-editor--hidden")?(s.removeClass("snippet-editor--hidden"),i.removeClass("snippet-editor--hidden"),o.removeClass("snippet-editor--hidden")):(s.addClass("snippet-editor--hidden"),i.addClass("snippet-editor--hidden")),t.addClass("snippet-editor--hidden")}),r("body").on("click","."+l.editSnippetSubmitClass,function(e){var t=r(this).data("language"),a=r("."+l.editSnippetButtonClass+"_"+t),s=r("."+l.editSnippetFormClass+"_"+t),o=r("."+l.editSnippetSubmitClass+"_"+t),i=r("."+l.editSnippetHeadingClass+"_"+t);a.removeClass("snippet-editor--hidden"),s.addClass("snippet-editor--hidden"),o.addClass("snippet-editor--hidden"),i.addClass("snippet-editor--hidden")}),r(document).on("keyup","input.wpglobus-snippet-editor-title",function(e){var t=r(this),a=t.data("language"),s=WPGlobusCore.getString(r('input[name="yoast_wpseo_title"]').val(),t.val(),a);r("#snippet_title_"+a).text(t.val()),YoastSEO.app.rawData.pageTitle=s,r('input[name="yoast_wpseo_title"]').val(s),r("#snippet_title").text(s),_.debounce(l.updateProgressBar(t,a),500)}),r(document).on("keyup","input.wpglobus-snippet-editor-slug",function(e){var t=r(this),a=t.data("language");r("#snippet_cite_"+a).text(t.val()+"/"),r("#editable-post-name").text(t.val()),r("#editable-post-name-full").text(t.val())}),r(document).on("change","input.wpglobus-snippet-editor-slug",function(e){var t=r(this);r.post(ajaxurl,{action:"sample-permalink",post_id:r("#post_ID").val()||0,new_slug:t.val(),new_title:r("#title").val(),samplepermalinknonce:r("#samplepermalinknonce").val()})}),r(document).on("keyup","textarea.wpglobus-snippet-editor-meta-description",function(e){var t=r(this),a=t.data("language");r("#snippet_meta_"+a).text(t.val());var s=WPGlobusCore.getString(r("#yoast_wpseo_metadesc").val(),t.val(),t.data("language"));r("#yoast_wpseo_metadesc").val(s),r("#snippet_meta").text(s),_.debounce(l.updateProgressBar(t,a),500)}),r("body").on("click",".wpglobus-post-body-tabs-list li",function(e){var t=r(this);if(t.hasClass("wpglobus-post-tab")){r("#wpglobus-wpseo-tabs").tabs("option","active",t.data("order"));var a=r("#yoast_wpseo_focuskw_text_input_"+r(this).data("language")).val();YoastSEO.app.rawData.keyword=a,r("#yoast_wpseo_focuskw_text_input").val(a),r('input[name="yoast_wpseo_focuskw"]').val(a),YoastSEO.app.analyzeTimer(YoastSEO.app)}}),l.qtip(),l.initAddKeywordPopup()}},(t=function(){this.replaceVars=wpseoReplaceVarsL10n.replace_vars,this.language=WPGlobusCoreData.default_language,this.tab=WPGlobusCoreData.default_language,this.wpseoTab=WPGlobusCoreData.default_language,this.title_template=wpseoPostScraperL10n.title_template,this.focuskw=r("#yoast_wpseo_focuskw_text_input"),this.focuskw_hidden=r('input[name="yoast_wpseo_focuskw"]'),this.focuskwKeep=!1,this.post_slug="#editable-post-name-full",YoastSEO.app.registerPlugin("wpglobusYoastSeoPlugin",{status:"ready"}),YoastSEO.app.registerModification("content",this.contentModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("title",this.titleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_title",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_meta",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_page_title",this.pageTitleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_meta_desc",this.metaDescModification,"wpglobusYoastSeoPlugin",0),r(document).on("blur",".wpglobus-snippet_title",function(e){var t=r(this),a=WPGlobusCore.getString(r("#yoast_wpseo_title").val(),t.text(),t.data("language"));YoastSEO.app.rawData.pageTitle=a,r('input[name="yoast_wpseo_title"]').val(a),r("#snippet_title").text(a)}),r(document).on("blur",".wpglobus-snippet_meta",function(e){var t=r(this),a=WPGlobusCore.getString(r("#yoast_wpseo_metadesc").val(),t.text(),t.data("language"));r("#yoast_wpseo_metadesc").val(a),r("#snippet_meta").text(a)}),r(document).on("keyup",".wpglobus-yoast_wpseo_focuskw_text_input",function(e){var t=r(this),a=t.val();p.focuskw.val(a),p.focuskw_hidden.val(a),p.updateWpseoKeyword(a,t.data("language")),YoastSEO.app.analyzeTimer(YoastSEO.app)}),r("#publish,#save-post").on("mouseenter",function(e){var a,s="";r(".wpglobus-yoast_wpseo_focuskw_text_input").each(function(e,t){a=r(this),s=WPGlobusCore.getString(s,a.val(),a.data("language"))}),p.focuskw.val(s),p.focuskw_hidden.val(s)}).on("mouseleave",function(e){if(!p.focuskwKeep){p.wpseoTab=r(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");r(this);p.focuskw.val(r("#yoast_wpseo_focuskw_text_input_"+p.wpseoTab).val()),p.focuskw_hidden.val(r("#yoast_wpseo_focuskw_text_input_"+p.wpseoTab).val())}}).on("click",function(e){p.focuskwKeep=!0}),r(WPGlobusYoastSeo.wpseoTabSelector).on("tabsactivate",function(e,t){if(t.newPanel.attr("data-language")===WPGlobusCoreData.default_language){WPGlobusYoastSeo.url=r(p.post_slug).text();var a=r("#yoast_wpseo_focuskw_text_input_"+WPGlobusCoreData.default_language).val();YoastSEO.app.rawData.keyword=a,p.focuskw.val(a),p.focuskw_hidden.val(a),YoastSEO.app.analyzeTimer(YoastSEO.app)}}),p=this}).prototype.getWPseoTab=function(){return r(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language")},t.prototype.citeModification=function(e){var t="#snippet_citeBase_"+e,a="#snippet_cite_"+e,s=r("#wpseo-tab-"+e).data("yoast-cite-base");!1===r("#wpseo-tab-"+e).data("cite-contenteditable")&&r(a).attr("contenteditable","false"),r(t).text(s)},t.prototype.pageTitleModification=function(a){var s,o="#snippet_title_",i="",n="";if(p.title_template==a)r.each(WPGlobusCoreData.enabled_languages,function(e,t){p.language=t,i=p.replaceVariablesPlugin(a),r(o+t).text(i),t==p.getWPseoTab()&&(n=i)});else{if(s=WPGlobusCore.getTranslations(a),p.getWPseoTab()!==WPGlobusCoreData.default_language&&s[WPGlobusCoreData.default_language]==a){var e=p.getWPseoTab();return r(o+e).text(a),a}r.each(WPGlobusCoreData.enabled_languages,function(e,t){p.language=t,i=""===s[t]?p.replaceVariablesPlugin(p.title_template):s[t],r(o+t).text(i),t==p.getWPseoTab()&&(n=i)})}return n},t.prototype.metaDescModification=function(a){var s="#snippet_meta_";if(p.getWPseoTab()!==WPGlobusCoreData.default_language&&WPGlobusCore.getTranslations(a)[WPGlobusCoreData.default_language]==a){var e=p.getWPseoTab();return r(s+e).text(a),p.citeModification(e),a}return r.each(WPGlobusCoreData.enabled_languages,function(e,t){r(s+t).text(WPGlobusCore.TextFilter(a,t,"RETURN_EMPTY")),p.citeModification(t)}),WPGlobusCore.TextFilter(a,p.getWPseoTab(),"RETURN_EMPTY")},t.prototype.snippetModification=function(e){return WPGlobusCore.TextFilter(e,p.getWPseoTab(),"RETURN_EMPTY")},t.prototype.contentModification=function(e){return p.getWPseoTab()==WPGlobusCoreData.default_language?e:r("#content_"+p.getWPseoTab()).val()},t.prototype.titleModification=function(e){return setTimeout(p.updatePageAnalysis,1e3),p.getWPseoTab()==WPGlobusCoreData.default_language?e:r("#title_"+p.getWPseoTab()).val()},t.prototype.defaultReplace=function(e){var t=YoastSEO.app.rawData.keyword;return e.replace(/%%sitedesc%%/g,this.replaceVars.sitedesc).replace(/%%sitename%%/g,this.replaceVars.sitename).replace(/%%term_title%%/g,this.replaceVars.term_title).replace(/%%term_description%%/g,this.replaceVars.term_description).replace(/%%category_description%%/g,this.replaceVars.category_description).replace(/%%tag_description%%/g,this.replaceVars.tag_description).replace(/%%searchphrase%%/g,this.replaceVars.searchphrase).replace(/%%date%%/g,this.replaceVars.date).replace(/%%id%%/g,this.replaceVars.id).replace(/%%page%%/g,this.replaceVars.page).replace(/%%currenttime%%/g,this.replaceVars.currenttime).replace(/%%currentdate%%/g,this.replaceVars.currentdate).replace(/%%currentday%%/g,this.replaceVars.currentday).replace(/%%currentmonth%%/g,this.replaceVars.currentmonth).replace(/%%currentyear%%/g,this.replaceVars.currentyear).replace(/%%focuskw%%/g,t)},t.prototype.replaceVariablesPlugin=function(e){return void 0!==e&&(e=this.titleReplace(e),e=this.defaultReplace(e),e=this.replaceSeparators(e)),e},t.prototype.replaceSeparators=function(e){return e.replace(/%%sep%%(\s+%%sep%%)*/g,this.replaceVars.sep)},t.prototype.titleReplace=function(e){var t="";return void 0===(t=this.language==WPGlobusCoreData.default_language?r("#title").val():r("#title_"+this.language).val())&&(t=YoastSEO.app.rawData.pageTitle),e=e.replace(/%%title%%/g,t)},t.prototype.doubleSepReplace=function(e){var t=YoastSEO.app.stringHelper.addEscapeChars(this.replaceVars.sep),a=new RegExp(t+" "+t,"g");return e=e.replace(a,this.replaceVars.sep)},t.prototype.updateWpseoKeyword=function(e,t){t!=WPGlobusCoreData.default_language&&(1==r("#wpseo-meta-section-content_"+t+" .wpseo_keyword").length&&r("#wpseo-meta-section-content_"+t+" .wpseo_keyword").removeClass("wpseo_keyword").addClass("wpglobus-wpseo_keyword_"+t),r(".wpglobus-wpseo_keyword_"+t).text(e))},t.prototype.updatePageAnalysis=function(){r("#wpseo-pageanalysis_"+p.getWPseoTab()).html(r("#wpseo-pageanalysis").html())},t.prototype.countMatches=function(e,t){return null!==e.match(t)?e.match.length:0},window.WPGlobusYoastSeoPlugin=new t,YoastSEO.Analyzer.prototype.urlKeyword=function(){var e=[{test:"urlKeyword",result:0}];return void 0!==WPGlobusYoastSeo&&""!==WPGlobusYoastSeo.url&&(this.config.url=WPGlobusYoastSeo.url),void 0!==this.config.url&&(e[0].result=t.prototype.countMatches(this.config.url,this.keywordRegexInverse)),e}}});
includes/js/wpglobus-yoastseo-32.min.js CHANGED
@@ -1 +1 @@
1
- var WPGlobusYoastSeo;jQuery(document).ready(function(e){"use strict";if("undefined"!=typeof wpseoReplaceVarsL10n&&"undefined"!=typeof WPGlobusCoreData&&"undefined"!=typeof WPGlobusVendor){var t;if("edit-tags.php"==WPGlobusVendor.pagenow||"term.php"==WPGlobusVendor.pagenow){t=WPGlobusYoastSeo={editorIDs:["description"],editor:{},submitId:"#submit",preventChangeEditor:!1,observer:null,init:function(){t.attachListeners(),_.delay(t.start,1500)},submit:function(a){"mouseenter"===a.type?e.each(t.editor,function(a,s){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(t.editor[a].content):tinymce.get(a).setContent(t.editor[a].content)}):"mouseleave"===a.type?t.preventChangeEditor||(e.each(t.editor,function(a,s){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(WPGlobusCore.TextFilter(s.content,t.getCurrentTab(),"RETURN_EMPTY")):tinymce.get(a).setContent(WPGlobusCore.TextFilter(s.content,t.getCurrentTab(),"RETURN_EMPTY"))}),t.preventChangeEditor=!1):"click"===a.type&&(t.preventChangeEditor=!0,"tinymce"!=getUserSetting("editor")&&setUserSetting("editor","tinymce"))},attachListeners:function(){e(".wrap").on("tabsactivate",function(a,s){e.each(t.editor,function(a,o){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(WPGlobusCore.TextFilter(o.content,s.newTab[0].dataset.language,"RETURN_EMPTY")):tinymce.get(a).setContent(WPGlobusCore.TextFilter(o.content,s.newTab[0].dataset.language,"RETURN_EMPTY"))})}),e(document).on("mouseenter",t.submitId,t.submit).on("mouseleave",t.submitId,t.submit).on("click",t.submitId,t.submit),e(document).on("tinymce-editor-init",function(a,s){if(-1!=_.indexOf(t.editorIDs,s.id)){var o=e("#"+s.id);t.editor[s.id]={},t.editor[s.id].contentEditor=s,t.editor[s.id].content=o.val(),s.setContent(WPGlobusCore.TextFilter(t.editor[s.id].content,WPGlobusCoreData.default_language,"RETURN_EMPTY")),e("#"+s.getContainer().id).find("iframe").addClass("wpglobus-translatable"),o.removeClass("hidden"),s.on("nodechange keyup",_.debounce(t.update,500)),o.on("input keyup",_.debounce(t.update,500))}})},update:function(a){var s,o;void 0!==a.target&&("tinymce"==(s=a.target.id)&&(s=a.target.dataset.id),void 0!==t.editor[s].contentEditor&&(o=!t.editor[s].contentEditor||t.editor[s].contentEditor.isHidden()?e("#"+s).val():t.editor[s].contentEditor.getContent({format:"raw"}),t.editor[s].content=WPGlobusCore.getString(t.editor[s].content,o,t.getCurrentTab())))},getCurrentTab:function(){return e(".wpglobus-taxonomy-tabs-list .ui-tabs-active").data("language")},start:function(){e(".wpglobus-element_description").css({display:"none"})}},WPGlobusYoastSeo.init();var a=function(){e(".wrap").on("tabsactivate",function(t,a){a.newTab[0].dataset.language==WPGlobusCoreData.default_language?e("#poststuff .inside").css({display:"block"}):e("#poststuff .inside").css({display:"none"})}),e.each(["category_description","sitedesc","sitename","tag_description","term_description","term_title"],function(e,t){wpseoReplaceVarsL10n.replace_vars[t]=WPGlobusCore.TextFilter(wpseoReplaceVarsL10n.replace_vars[t],WPGlobusCoreData.default_language)}),WPGlobusYoastSeo.observer=new MutationObserver(function(t){t.forEach(function(t){if("placeholder"==t.attributeName){WPGlobusYoastSeo.observer.disconnect();var a=e("#wpseo_focuskw");""==a.val()&&a.attr("placeholder",WPGlobusCore.TextFilter(a.attr("placeholder"),WPGlobusCoreData.default_language)),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})}})}),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})};window.WPGlobusYoastSeoPlugin=new a}else{t=WPGlobusYoastSeo={wpseoTabSelector:"#wpglobus-wpseo-tabs",url:"",attrs:e("#wpglobus-wpseo-attr"),iB:e("#wpseo-meta-section-content"),t:e("#wpseo-meta-section-content"),ids:"",names:"",editSnippetButtonClass:"wpglobus-snippet-editor__edit-button",editSnippetFormClass:"wpglobus-snippet-editor__form",editSnippetSubmitClass:"wpglobus-snippet-editor__submit",editSnippetHeadingClass:"wpglobus-snippet-editor__heading-editor",yoastTitleProgress:"wpglobus-yoast-title-progress",yoastMetadescProgress:"wpglobus-yoast-metadesc-progress",init:function(){t.start()},initAddKeywordPopup:function(){1===e("#wpseo-add-keyword-popup").length&&e(".wpseo-add-keyword").on("click",t.addKeywordPopup)},addKeywordPopup:function(){var t=e("#wpseo-add-keyword-popup-button").text();tb_show(t,"#TB_inline?width=650&height=350&inlineId=wpseo-add-keyword-popup","group"),jQuery("#TB_window").css("height",235),jQuery("#TB_window").css("width",680)},qtip:function(){e(".yoast_help").qtip({content:{attr:"alt"},position:{my:"bottom left",at:"top center"},style:{tip:{corner:!0},classes:"yoast-qtip qtip-rounded qtip-blue"},show:"click",hide:{fixed:!0,delay:500}})},removeClasses:function(e,t){_.each(t,function(t){e.removeClass(t)})},updateProgressBar:function(a,s){if(void 0!==a&&(void 0!==s||("undefined"!==a.data("language")&&(s=a.data("language")),void 0!==s))){var o,i=["snippet-editor__progress--bad","snippet-editor__progress--ok","snippet-editor__progress--good"],n=0,p="",l=0,r=!1;n=a.val().length,a.hasClass("wpglobus-snippet-editor-title")?(l=(o=e("progress."+t.yoastTitleProgress+"_"+s)).attr("max"),p=i[2],0==n?p=i[1]:n>l?(p=i[1],r=!0):n>0&&n<35&&(p=i[1])):a.hasClass("wpglobus-snippet-editor-meta-description")&&(l=(o=e("progress."+t.yoastMetadescProgress+"_"+s)).attr("max"),p=i[2],0==n?p=i[1]:n>l?(p=i[1],r=!0):n>0&&n<121&&(p=i[1])),t.removeClasses(o,i),o.attr("value",n).addClass(p),r?a.css("color","#f00"):a.css("color","#000")}},updateWpseoKeyword:function(t,a){e("#wpseo-meta-section-content_"+a+" .wpseo_keyword").text(t)},start:function(){e(t.wpseoTabSelector).tabs(),t.ids=t.attrs.data("ids"),t.names=t.attrs.data("names"),t.ids=t.ids+","+t.attrs.data("qtip"),t.ids=t.ids.split(","),t.names=t.names.split(","),e("#wpglobus-wpseo-tabs").insertBefore(t.iB),e(".wpseo-metabox-tabs").css({height:"26px"}),e(".wpglobus-wpseo-general").each(function(a,s){var o=e(s),i=o.data("language"),n="wpseo-meta-section-content_"+i;o.html('<div id="'+n+'" class="wpseo-meta-section wpglobus-wpseo-meta-section" style="width:100%" data-language="'+i+'">'+t.t.html()+"</div>"),e("#"+n+" .wpseo-metabox-tabs").attr("id","wpseo-metabox-tabs_"+i),e("#"+n+" .wpseotab").attr("id","wpseo_content_"+i),e("#wpseo_content_"+i).css({float:"left"}),e("#"+n).css({display:"block"}),e("#wpseo_meta").css({overflow:"hidden"}),e("#"+n+" .snippet_container").addClass("wpglobus-snippet_container"),i!==WPGlobusCoreData.default_language&&e("#"+n+" .wpseo-add-keyword").addClass("hidden"),e.each(t.names,function(t,a){e("#"+a).attr("name",a+"_"+i)}),e.each(t.ids,function(a,s){var o=e("#"+s);"wpseosnippet"==s&&o.addClass("wpglobus-wpseosnippet"),"snippet_title"==s&&o.addClass("wpglobus-snippet_title"),"snippet_meta"==s&&o.addClass("wpglobus-snippet_meta"),"snippet_cite"==s&&o.addClass("wpglobus-snippet_cite"),"snippet_citeBase"==s&&o.addClass("wpglobus-snippet_citeBase"),"yoast_wpseo_focuskw_text_input"==s&&o.addClass("wpglobus-yoast_wpseo_focuskw_text_input"),"wpseo-pageanalysis"==s&&o.addClass("wpglobus-wpseo-pageanalysis"),"snippet_preview"==s&&o.addClass("wpglobus-snippet_preview"),"snippet-editor-title"==s&&(o.addClass("wpglobus-snippet-editor-title"),o.parent("label").attr("for",o.parent("label").attr("for")+"_"+i),o.val(e("#wpseo-tab-"+i).data("wpseotitle")),o.parent("label").find("progress").addClass(t.yoastTitleProgress).addClass(t.yoastTitleProgress+"_"+i),_.debounce(t.updateProgressBar(o,i),500)),"snippet-editor-slug"==s&&(o.addClass("wpglobus-snippet-editor-slug"),o.parent("label").attr("for",o.parent("label").attr("for")+"_"+i),WPGlobusCoreData.default_language!=i&&o.attr("disabled","disabled")),"snippet-editor-meta-description"==s&&(o.addClass("wpglobus-snippet-editor-meta-description"),o.parent("label").attr("for",o.parent("label").attr("for")+"_"+i),o.val(e("#wpseo-tab-"+i).data("metadesc")),o.parent("label").find("progress").addClass(t.yoastMetadescProgress).addClass(t.yoastMetadescProgress+"_"+i),_.debounce(t.updateProgressBar(o,i),500)),"snippetpreview-help-toggle"==s&&(o.addClass("wpglobus-snippetpreview-help-toggle_"+i),e(document).on("click",".wpglobus-snippetpreview-help-toggle_"+i,function(t){var a=e(this);"none"===e("#snippetpreview-help_"+a.data("language")).css("display")?e("#snippetpreview-help_"+a.data("language")).css({display:"block"}):e("#snippetpreview-help_"+a.data("language")).css({display:"none"})})),"focuskw_text_input-help-toggle"==s&&(o.addClass("wpglobus-focuskw_text_input-help-toggle_"+i),e(document).on("click",".wpglobus-focuskw_text_input-help-toggle_"+i,function(t){var a=e(this);"none"===e("#focuskw_text_input-help_"+a.data("language")).css("display")?e("#focuskw_text_input-help_"+a.data("language")).css({display:"block"}):e("#focuskw_text_input-help_"+a.data("language")).css({display:"none"})})),"pageanalysis-help-toggle"==s&&(o.addClass("wpglobus-pageanalysis-help-toggle_"+i),e(document).on("click",".wpglobus-pageanalysis-help-toggle_"+i,function(t){var a=e(this);"none"===e("#pageanalysis-help_"+a.data("language")).css("display")?e("#pageanalysis-help_"+a.data("language")).css({display:"block"}):e("#pageanalysis-help_"+a.data("language")).css({display:"none"})})),o.attr("id",s+"_"+i),e("#"+s+"_"+i).attr("data-language",i)});var p=WPGlobusCore.TextFilter(e("#yoast_wpseo_focuskw_text_input").val(),i,"RETURN_EMPTY");e("#yoast_wpseo_focuskw_text_input_"+i).val(p),e("#yoast_wpseo_focuskw_"+i).val(p),t.updateWpseoKeyword(p,i),i!==WPGlobusCoreData.default_language&&(e("#"+n+" #yoast_wpseo_focuskw_text_input_"+i).addClass("hidden").after('<div class="wpglobus-suggest" style="font-weight:bold;">'+WPGlobusVendor.i18n.yoastseo_plus_access+"</div>"),e("#"+n+" #wpseo-pageanalysis_"+i).addClass("hidden"))}),e(".wpglobus-wpseosnippet").each(function(a,s){var o=e(s),i=o.data("language");o.find("button.snippet-editor__button.snippet-editor__edit-button").addClass(t.editSnippetButtonClass).addClass(t.editSnippetButtonClass+"_"+i).attr("data-language",i),o.find(".snippet-editor__form").addClass(t.editSnippetFormClass).addClass(t.editSnippetFormClass+"_"+i),o.find(".snippet-editor__heading-editor").addClass(t.editSnippetHeadingClass).addClass(t.editSnippetHeadingClass+"_"+i),o.find(".snippet-editor__submit").addClass(t.editSnippetSubmitClass).addClass(t.editSnippetSubmitClass+"_"+i).attr("data-language",i)}),t.iB.addClass("hidden"),t.iB.css({height:0,overflow:"hidden"});var o=WPGlobusCore.TextFilter(e("#yoast_wpseo_focuskw_text_input").val(),WPGlobusCoreData.default_language,"RETURN_EMPTY");e("#yoast_wpseo_focuskw_text_input").val(o),e("#yoast_wpseo_focuskw").val(o),e(".wpseo-metabox-sidebar .wpseo-meta-section-link").on("click",function(t){"#wpseo-meta-section-content"==e(this).attr("href")?e("#wpglobus-wpseo-tabs").css({display:"block"}):e("#wpglobus-wpseo-tabs").css({display:"none"})}),e("body").on("click","."+t.editSnippetButtonClass,function(a){var s=e(this),o=s.data("language"),i=e("."+t.editSnippetFormClass+"_"+o),n=e("."+t.editSnippetSubmitClass+"_"+o),p=e("."+t.editSnippetHeadingClass+"_"+o);i.hasClass("snippet-editor--hidden")?(i.removeClass("snippet-editor--hidden"),p.removeClass("snippet-editor--hidden"),n.removeClass("snippet-editor--hidden")):(i.addClass("snippet-editor--hidden"),p.addClass("snippet-editor--hidden")),s.addClass("snippet-editor--hidden")}),e("body").on("click","."+t.editSnippetSubmitClass,function(a){var s=e(this).data("language"),o=e("."+t.editSnippetButtonClass+"_"+s),i=e("."+t.editSnippetFormClass+"_"+s),n=e("."+t.editSnippetSubmitClass+"_"+s),p=e("."+t.editSnippetHeadingClass+"_"+s);o.removeClass("snippet-editor--hidden"),i.addClass("snippet-editor--hidden"),n.addClass("snippet-editor--hidden"),p.addClass("snippet-editor--hidden")}),e(document).on("keyup","input.wpglobus-snippet-editor-title",function(a){var o=e(this),i=o.data("language"),n=WPGlobusCore.getString(e('input[name="yoast_wpseo_title"]').val(),o.val(),i);e("#snippet_title_"+i).html(s.replaceVariablesPlugin(o.val())),YoastSEO.app.rawData.pageTitle=n,e('input[name="yoast_wpseo_title"]').val(n),e("#snippet_title").text(n),_.debounce(t.updateProgressBar(o,i),500)}),e(document).on("keyup","input.wpglobus-snippet-editor-slug",function(t){var a=e(this),s=a.data("language");e("#snippet_cite_"+s).text(a.val()+"/"),e("#editable-post-name").text(a.val()),e("#editable-post-name-full").text(a.val())}),e(document).on("change","input.wpglobus-snippet-editor-slug",function(t){var a=e(this);e.post(ajaxurl,{action:"sample-permalink",post_id:e("#post_ID").val()||0,new_slug:a.val(),new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()})}),e(document).on("keyup","textarea.wpglobus-snippet-editor-meta-description",function(a){var s=e(this),o=s.data("language");e("#snippet_meta_"+o).text(s.val());var i=WPGlobusCore.getString(e("#yoast_wpseo_metadesc").val(),s.val(),s.data("language"));e("#yoast_wpseo_metadesc").val(i),e("#snippet_meta").text(i),_.debounce(t.updateProgressBar(s,o),500)}),e("body").on("click",".wpglobus-post-body-tabs-list li",function(t){var s=e(this);if(s.hasClass("wpglobus-post-tab")){e("#wpglobus-wpseo-tabs").tabs("option","active",s.data("order"));var o=e("#yoast_wpseo_focuskw_text_input_"+e(this).data("language")).val();YoastSEO.app.rawData.keyword=o,e("#yoast_wpseo_focuskw_text_input").val(o),e('input[name="yoast_wpseo_focuskw"]').val(o),a.prototype.analyze()}}),t.initAddKeywordPopup()}};var s;(a=function(){this.replaceVars=wpseoReplaceVarsL10n.replace_vars,this.language=WPGlobusCoreData.default_language,this.tab=WPGlobusCoreData.default_language,this.wpseoTab=WPGlobusCoreData.default_language,this.title_template=wpseoPostScraperL10n.title_template,this.focuskw=e("#yoast_wpseo_focuskw_text_input"),this.focuskw_hidden=e('input[name="yoast_wpseo_focuskw"]'),this.focuskwKeep=!1,this.post_slug="#editable-post-name-full",YoastSEO.app.registerPlugin("wpglobusYoastSeoPlugin",{status:"ready"}),YoastSEO.app.registerModification("content",this.contentModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("title",this.titleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_title",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_meta",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_page_title",this.pageTitleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_meta_desc",this.metaDescModification,"wpglobusYoastSeoPlugin",0),a.prototype.setScoreIcon(),e(document).on("blur",".wpglobus-snippet_title",function(t){var a=e(this),s=WPGlobusCore.getString(e("#yoast_wpseo_title").val(),a.text(),a.data("language"));YoastSEO.app.rawData.pageTitle=s,e('input[name="yoast_wpseo_title"]').val(s),e("#snippet_title").text(s)}),e(document).on("blur",".wpglobus-snippet_meta",function(t){var a=e(this),s=WPGlobusCore.getString(e("#yoast_wpseo_metadesc").val(),a.text(),a.data("language"));e("#yoast_wpseo_metadesc").val(s),e("#snippet_meta").text(s)}),e(document).on("keyup",".wpglobus-yoast_wpseo_focuskw_text_input",function(t){var o=e(this),i=o.val();s.focuskw.val(i),s.focuskw_hidden.val(i),s.updateWpseoKeyword(i,o.data("language")),a.prototype.analyze()}),e("#publish,#save-post").on("mouseenter",function(t){var a,o="";e(".wpglobus-yoast_wpseo_focuskw_text_input").each(function(t,s){a=e(this),o=WPGlobusCore.getString(o,a.val(),a.data("language"))}),s.focuskw.val(o),s.focuskw_hidden.val(o)}).on("mouseleave",function(t){if(!s.focuskwKeep){s.wpseoTab=e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");e(this);s.focuskw.val(e("#yoast_wpseo_focuskw_text_input_"+s.wpseoTab).val()),s.focuskw_hidden.val(e("#yoast_wpseo_focuskw_text_input_"+s.wpseoTab).val())}}).on("click",function(e){s.focuskwKeep=!0}),e(WPGlobusYoastSeo.wpseoTabSelector).on("tabsactivate",function(t,o){if(s.language=o.newPanel.attr("data-language"),o.newPanel.attr("data-language")===WPGlobusCoreData.default_language){var i=e("#yoast_wpseo_focuskw_text_input_"+WPGlobusCoreData.default_language).val();YoastSEO.app.rawData.keyword=i,s.focuskw.val(i),s.focuskw_hidden.val(i)}a.prototype.analyze()}),s=this}).prototype.analyze=function(){var t=e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");t==WPGlobusCoreData.default_language?YoastSEO.app.snippetPreview.data.urlPath=e("#editable-post-name-full").text():0!=e("#editable-post-name-full-"+t).length?YoastSEO.app.snippetPreview.data.urlPath=e("#editable-post-name-full-"+t).text():YoastSEO.app.snippetPreview.data.urlPath=e("#editable-post-name-full").text(),YoastSEO.app.analyzeTimer(YoastSEO.app),a.prototype.setScoreIcon()},a.prototype.setScoreIcon=function(){var t;t=setInterval(function(){var a=e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language"),s=e("#wpseo-metabox-tabs .wpseo-score-icon").attr("class");"bad"!=(s=s.replace("wpseo-score-icon ",""))&&"ok"!=s&&"good"!=s||(e("#wpseo-metabox-tabs_"+a+" .wpseo-score-icon").removeClass("bad ok good 100"),e("#wpseo-metabox-tabs_"+a+" .wpseo-score-icon").addClass(s),clearInterval(t))},700)},a.prototype.getWPseoTab=function(){return e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language")},a.prototype.citeModification=function(t){var a="#snippet_citeBase_"+t,s="#snippet_cite_"+t,o=e("#wpseo-tab-"+t).data("yoast-cite-base");!1===e("#wpseo-tab-"+t).data("cite-contenteditable")&&e(s).attr("contenteditable","false"),e(a).text(o)},a.prototype.pageTitleModification=function(t){var a,o,i,n="#snippet_title_",p="",l="";if(s.title_template==t)e.each(WPGlobusCoreData.enabled_languages,function(t,a){o=e("#snippet-editor-title_"+a).val(),i=0==o.length?s.title_template:o,p=s.replaceVariablesPlugin(i),e(n+a).text(p),a==s.getWPseoTab()&&(l=p)});else{if(a=WPGlobusCore.getTranslations(t),s.getWPseoTab()!==WPGlobusCoreData.default_language&&a[WPGlobusCoreData.default_language]==t){var r=s.getWPseoTab();return o=e("#snippet-editor-title_"+r).val(),i=o.length>0?o:s.title_template,i=s.replaceVariablesPlugin(i),e(n+r).text(i),i}e.each(WPGlobusCoreData.enabled_languages,function(t,i){p=""===a[i]?s.replaceVariablesPlugin(s.title_template):s.replaceVariablesPlugin(a[i]),i==s.getWPseoTab()&&(l=p,0!=(o=e("#snippet-editor-title_"+i).val()).length?o!=l&&(l=s.replaceVariablesPlugin(o)):l=s.replaceVariablesPlugin(s.title_template)),e(n+i).html(l)})}return l},a.prototype.metaDescModification=function(t){var a="#snippet_meta_",o="",i=WPGlobusCore.getTranslations(t),n="";if(o=e("#snippet-editor-meta-description_"+s.getWPseoTab()).val(),s.getWPseoTab()!==WPGlobusCoreData.default_language&&i[WPGlobusCoreData.default_language]==t){var p=s.getWPseoTab();return s.citeModification(p),0==o.length?e(a+p).text(""):o!=t&&e(a+p).text(o),t}return e.each(WPGlobusCoreData.enabled_languages,function(o,i){e(a+i).text(WPGlobusCore.TextFilter(t,i,"RETURN_EMPTY")),s.citeModification(i)}),o==i[s.getWPseoTab()]?0==(n=i[s.getWPseoTab()]).length&&e(a+s.getWPseoTab()).text(WPGlobusCore.TextFilter(YoastSEO.app.snippetPreview.data.metaDesc,WPGlobusCoreData.default_language,"RETURN_EMPTY")):0==(n=o).length?e(a+s.getWPseoTab()).text(WPGlobusCore.TextFilter(YoastSEO.app.snippetPreview.data.metaDesc,WPGlobusCoreData.default_language,"RETURN_EMPTY")):e(a+s.getWPseoTab()).text(n),e(a+s.getWPseoTab()).text(n),n},a.prototype.snippetModification=function(e){return WPGlobusCore.TextFilter(e,s.getWPseoTab(),"RETURN_EMPTY")},a.prototype.contentModification=function(t){return s.getWPseoTab()==WPGlobusCoreData.default_language?t:e("#content_"+s.getWPseoTab()).val()},a.prototype.titleModification=function(t){return setTimeout(s.updatePageAnalysis,1e3),s.getWPseoTab()==WPGlobusCoreData.default_language?t:e("#title_"+s.getWPseoTab()).val()},a.prototype.defaultReplace=function(e){var t=YoastSEO.app.rawData.keyword;return e.replace(/%%sitedesc%%/g,this.replaceVars.sitedesc).replace(/%%sitename%%/g,WPGlobusCore.TextFilter(this.replaceVars.sitename,s.getWPseoTab())).replace(/%%term_title%%/g,this.replaceVars.term_title).replace(/%%term_description%%/g,this.replaceVars.term_description).replace(/%%category_description%%/g,this.replaceVars.category_description).replace(/%%tag_description%%/g,this.replaceVars.tag_description).replace(/%%searchphrase%%/g,this.replaceVars.searchphrase).replace(/%%date%%/g,this.replaceVars.date).replace(/%%id%%/g,this.replaceVars.id).replace(/%%page%%/g,this.replaceVars.page).replace(/%%currenttime%%/g,this.replaceVars.currenttime).replace(/%%currentdate%%/g,this.replaceVars.currentdate).replace(/%%currentday%%/g,this.replaceVars.currentday).replace(/%%currentmonth%%/g,this.replaceVars.currentmonth).replace(/%%currentyear%%/g,this.replaceVars.currentyear).replace(/%%focuskw%%/g,t)},a.prototype.replaceVariablesPlugin=function(e){return void 0!==e&&(e=this.titleReplace(e),e=this.defaultReplace(e),e=this.replaceSeparators(e)),e},a.prototype.replaceSeparators=function(e){return e.replace(/%%sep%%(\s+%%sep%%)*/g,this.replaceVars.sep)},a.prototype.titleReplace=function(t){var a="";return void 0===(a=this.language==WPGlobusCoreData.default_language?e("#title").val():e("#title_"+this.language).val())&&(a=YoastSEO.app.rawData.pageTitle),this.language!=WPGlobusCoreData.default_language&&0==a.length&&(a=e("#title").val()),t=t.replace(/%%title%%/g,a)},a.prototype.doubleSepReplace=function(e){var t=YoastSEO.app.stringHelper.addEscapeChars(this.replaceVars.sep),a=new RegExp(t+" "+t,"g");return e=e.replace(a,this.replaceVars.sep)},a.prototype.updateWpseoKeyword=function(t,a){1==e("#wpseo-meta-section-content_"+a+" .wpseo_keyword").length&&e("#wpseo-meta-section-content_"+a+" .wpseo_keyword").removeClass("wpseo_keyword").addClass("wpglobus-wpseo_keyword_"+a),e(".wpglobus-wpseo_keyword_"+a).text(t)},a.prototype.updatePageAnalysis=function(){e("#wpseo-pageanalysis_"+s.getWPseoTab()).html(e("#wpseo-pageanalysis").html())},window.WPGlobusYoastSeoPlugin=new a}}});
1
+ var WPGlobusYoastSeo;jQuery(document).ready(function(l){"use strict";var r;if("undefined"!=typeof wpseoReplaceVarsL10n&&("undefined"!=typeof WPGlobusCoreData&&"undefined"!=typeof WPGlobusVendor))if("edit-tags.php"==WPGlobusVendor.pagenow||"term.php"==WPGlobusVendor.pagenow){r=WPGlobusYoastSeo={editorIDs:["description"],editor:{},submitId:"#submit",preventChangeEditor:!1,observer:null,init:function(){r.attachListeners(),_.delay(r.start,1500)},submit:function(e){"mouseenter"===e.type?l.each(r.editor,function(e,t){!r.editor[e].contentEditor||r.editor[e].contentEditor.isHidden()?l("#"+e).val(r.editor[e].content):tinymce.get(e).setContent(r.editor[e].content)}):"mouseleave"===e.type?r.preventChangeEditor||(l.each(r.editor,function(e,t){!r.editor[e].contentEditor||r.editor[e].contentEditor.isHidden()?l("#"+e).val(WPGlobusCore.TextFilter(t.content,r.getCurrentTab(),"RETURN_EMPTY")):tinymce.get(e).setContent(WPGlobusCore.TextFilter(t.content,r.getCurrentTab(),"RETURN_EMPTY"))}),r.preventChangeEditor=!1):"click"===e.type&&(r.preventChangeEditor=!0,"tinymce"!=getUserSetting("editor")&&setUserSetting("editor","tinymce"))},attachListeners:function(){l(".wrap").on("tabsactivate",function(e,a){l.each(r.editor,function(e,t){!r.editor[e].contentEditor||r.editor[e].contentEditor.isHidden()?l("#"+e).val(WPGlobusCore.TextFilter(t.content,a.newTab[0].dataset.language,"RETURN_EMPTY")):tinymce.get(e).setContent(WPGlobusCore.TextFilter(t.content,a.newTab[0].dataset.language,"RETURN_EMPTY"))})}),l(document).on("mouseenter",r.submitId,r.submit).on("mouseleave",r.submitId,r.submit).on("click",r.submitId,r.submit),l(document).on("tinymce-editor-init",function(e,t){if(-1!=_.indexOf(r.editorIDs,t.id)){var a=l("#"+t.id);r.editor[t.id]={},r.editor[t.id].contentEditor=t,r.editor[t.id].content=a.val(),t.setContent(WPGlobusCore.TextFilter(r.editor[t.id].content,WPGlobusCoreData.default_language,"RETURN_EMPTY")),l("#"+t.getContainer().id).find("iframe").addClass("wpglobus-translatable"),a.removeClass("hidden"),t.on("nodechange keyup",_.debounce(r.update,500)),a.on("input keyup",_.debounce(r.update,500))}})},update:function(e){var t,a;void 0!==e.target&&("tinymce"==(t=e.target.id)&&(t=e.target.dataset.id),void 0!==r.editor[t].contentEditor&&(a=!r.editor[t].contentEditor||r.editor[t].contentEditor.isHidden()?l("#"+t).val():r.editor[t].contentEditor.getContent({format:"raw"}),r.editor[t].content=WPGlobusCore.getString(r.editor[t].content,a,r.getCurrentTab())))},getCurrentTab:function(){return l(".wpglobus-taxonomy-tabs-list .ui-tabs-active").data("language")},start:function(){l(".wpglobus-element_description").css({display:"none"})}},WPGlobusYoastSeo.init();var s=function(){l(".wrap").on("tabsactivate",function(e,t){t.newTab[0].dataset.language==WPGlobusCoreData.default_language?l("#poststuff .inside").css({display:"block"}):l("#poststuff .inside").css({display:"none"})}),l.each(["category_description","sitedesc","sitename","tag_description","term_description","term_title"],function(e,t){wpseoReplaceVarsL10n.replace_vars[t]=WPGlobusCore.TextFilter(wpseoReplaceVarsL10n.replace_vars[t],WPGlobusCoreData.default_language)}),WPGlobusYoastSeo.observer=new MutationObserver(function(e){e.forEach(function(e){if("placeholder"==e.attributeName){WPGlobusYoastSeo.observer.disconnect();var t=l("#wpseo_focuskw");""==t.val()&&t.attr("placeholder",WPGlobusCore.TextFilter(t.attr("placeholder"),WPGlobusCoreData.default_language)),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})}})}),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})};window.WPGlobusYoastSeoPlugin=new s}else{var d;r=WPGlobusYoastSeo={wpseoTabSelector:"#wpglobus-wpseo-tabs",url:"",attrs:l("#wpglobus-wpseo-attr"),iB:l("#wpseo-meta-section-content"),t:l("#wpseo-meta-section-content"),ids:"",names:"",editSnippetButtonClass:"wpglobus-snippet-editor__edit-button",editSnippetFormClass:"wpglobus-snippet-editor__form",editSnippetSubmitClass:"wpglobus-snippet-editor__submit",editSnippetHeadingClass:"wpglobus-snippet-editor__heading-editor",yoastTitleProgress:"wpglobus-yoast-title-progress",yoastMetadescProgress:"wpglobus-yoast-metadesc-progress",init:function(){r.start()},initAddKeywordPopup:function(){1===l("#wpseo-add-keyword-popup").length&&l(".wpseo-add-keyword").on("click",r.addKeywordPopup)},addKeywordPopup:function(){var e=l("#wpseo-add-keyword-popup-button").text();tb_show(e,"#TB_inline?width=650&height=350&inlineId=wpseo-add-keyword-popup","group"),jQuery("#TB_window").css("height",235),jQuery("#TB_window").css("width",680)},qtip:function(){l(".yoast_help").qtip({content:{attr:"alt"},position:{my:"bottom left",at:"top center"},style:{tip:{corner:!0},classes:"yoast-qtip qtip-rounded qtip-blue"},show:"click",hide:{fixed:!0,delay:500}})},removeClasses:function(t,e){_.each(e,function(e){t.removeClass(e)})},updateProgressBar:function(e,t){if(void 0!==e&&(void 0!==t||("undefined"!==e.data("language")&&(t=e.data("language")),void 0!==t))){var a,s,o=["snippet-editor__progress--bad","snippet-editor__progress--ok","snippet-editor__progress--good"],i="",n=0,p=!1;s=e.val().length,e.hasClass("wpglobus-snippet-editor-title")?(n=(a=l("progress."+r.yoastTitleProgress+"_"+t)).attr("max"),i=o[2],0==s?i=o[1]:n<s?(i=o[1],p=!0):0<s&&s<35&&(i=o[1])):e.hasClass("wpglobus-snippet-editor-meta-description")&&(n=(a=l("progress."+r.yoastMetadescProgress+"_"+t)).attr("max"),i=o[2],0==s?i=o[1]:n<s?(i=o[1],p=!0):0<s&&s<121&&(i=o[1])),r.removeClasses(a,o),a.attr("value",s).addClass(i),p?e.css("color","#f00"):e.css("color","#000")}},updateWpseoKeyword:function(e,t){l("#wpseo-meta-section-content_"+t+" .wpseo_keyword").text(e)},start:function(){l(r.wpseoTabSelector).tabs(),r.ids=r.attrs.data("ids"),r.names=r.attrs.data("names"),r.ids=r.ids+","+r.attrs.data("qtip"),r.ids=r.ids.split(","),r.names=r.names.split(","),l("#wpglobus-wpseo-tabs").insertBefore(r.iB),l(".wpseo-metabox-tabs").css({height:"26px"}),l(".wpglobus-wpseo-general").each(function(e,t){var a=l(t),s=a.data("language"),o="wpseo-meta-section-content_"+s;a.html('<div id="'+o+'" class="wpseo-meta-section wpglobus-wpseo-meta-section" style="width:100%" data-language="'+s+'">'+r.t.html()+"</div>"),l("#"+o+" .wpseo-metabox-tabs").attr("id","wpseo-metabox-tabs_"+s),l("#"+o+" .wpseotab").attr("id","wpseo_content_"+s),l("#wpseo_content_"+s).css({float:"left"}),l("#"+o).css({display:"block"}),l("#wpseo_meta").css({overflow:"hidden"}),l("#"+o+" .snippet_container").addClass("wpglobus-snippet_container"),s!==WPGlobusCoreData.default_language&&l("#"+o+" .wpseo-add-keyword").addClass("hidden"),l.each(r.names,function(e,t){l("#"+t).attr("name",t+"_"+s)}),l.each(r.ids,function(e,t){var a=l("#"+t);"wpseosnippet"==t&&a.addClass("wpglobus-wpseosnippet"),"snippet_title"==t&&a.addClass("wpglobus-snippet_title"),"snippet_meta"==t&&a.addClass("wpglobus-snippet_meta"),"snippet_cite"==t&&a.addClass("wpglobus-snippet_cite"),"snippet_citeBase"==t&&a.addClass("wpglobus-snippet_citeBase"),"yoast_wpseo_focuskw_text_input"==t&&a.addClass("wpglobus-yoast_wpseo_focuskw_text_input"),"wpseo-pageanalysis"==t&&a.addClass("wpglobus-wpseo-pageanalysis"),"snippet_preview"==t&&a.addClass("wpglobus-snippet_preview"),"snippet-editor-title"==t&&(a.addClass("wpglobus-snippet-editor-title"),a.parent("label").attr("for",a.parent("label").attr("for")+"_"+s),a.val(l("#wpseo-tab-"+s).data("wpseotitle")),a.parent("label").find("progress").addClass(r.yoastTitleProgress).addClass(r.yoastTitleProgress+"_"+s),_.debounce(r.updateProgressBar(a,s),500)),"snippet-editor-slug"==t&&(a.addClass("wpglobus-snippet-editor-slug"),a.parent("label").attr("for",a.parent("label").attr("for")+"_"+s),WPGlobusCoreData.default_language!=s&&a.attr("disabled","disabled")),"snippet-editor-meta-description"==t&&(a.addClass("wpglobus-snippet-editor-meta-description"),a.parent("label").attr("for",a.parent("label").attr("for")+"_"+s),a.val(l("#wpseo-tab-"+s).data("metadesc")),a.parent("label").find("progress").addClass(r.yoastMetadescProgress).addClass(r.yoastMetadescProgress+"_"+s),_.debounce(r.updateProgressBar(a,s),500)),"snippetpreview-help-toggle"==t&&(a.addClass("wpglobus-snippetpreview-help-toggle_"+s),l(document).on("click",".wpglobus-snippetpreview-help-toggle_"+s,function(e){var t=l(this);"none"===l("#snippetpreview-help_"+t.data("language")).css("display")?l("#snippetpreview-help_"+t.data("language")).css({display:"block"}):l("#snippetpreview-help_"+t.data("language")).css({display:"none"})})),"focuskw_text_input-help-toggle"==t&&(a.addClass("wpglobus-focuskw_text_input-help-toggle_"+s),l(document).on("click",".wpglobus-focuskw_text_input-help-toggle_"+s,function(e){var t=l(this);"none"===l("#focuskw_text_input-help_"+t.data("language")).css("display")?l("#focuskw_text_input-help_"+t.data("language")).css({display:"block"}):l("#focuskw_text_input-help_"+t.data("language")).css({display:"none"})})),"pageanalysis-help-toggle"==t&&(a.addClass("wpglobus-pageanalysis-help-toggle_"+s),l(document).on("click",".wpglobus-pageanalysis-help-toggle_"+s,function(e){var t=l(this);"none"===l("#pageanalysis-help_"+t.data("language")).css("display")?l("#pageanalysis-help_"+t.data("language")).css({display:"block"}):l("#pageanalysis-help_"+t.data("language")).css({display:"none"})})),a.attr("id",t+"_"+s),l("#"+t+"_"+s).attr("data-language",s)});var i=WPGlobusCore.TextFilter(l("#yoast_wpseo_focuskw_text_input").val(),s,"RETURN_EMPTY");l("#yoast_wpseo_focuskw_text_input_"+s).val(i),l("#yoast_wpseo_focuskw_"+s).val(i),r.updateWpseoKeyword(i,s),s!==WPGlobusCoreData.default_language&&(l("#"+o+" #yoast_wpseo_focuskw_text_input_"+s).addClass("hidden").after('<div class="wpglobus-suggest" style="font-weight:bold;">'+WPGlobusVendor.i18n.yoastseo_plus_access+"</div>"),l("#"+o+" #wpseo-pageanalysis_"+s).addClass("hidden"))}),l(".wpglobus-wpseosnippet").each(function(e,t){var a=l(t),s=a.data("language");a.find("button.snippet-editor__button.snippet-editor__edit-button").addClass(r.editSnippetButtonClass).addClass(r.editSnippetButtonClass+"_"+s).attr("data-language",s),a.find(".snippet-editor__form").addClass(r.editSnippetFormClass).addClass(r.editSnippetFormClass+"_"+s),a.find(".snippet-editor__heading-editor").addClass(r.editSnippetHeadingClass).addClass(r.editSnippetHeadingClass+"_"+s),a.find(".snippet-editor__submit").addClass(r.editSnippetSubmitClass).addClass(r.editSnippetSubmitClass+"_"+s).attr("data-language",s)}),r.iB.addClass("hidden"),r.iB.css({height:0,overflow:"hidden"});var e=WPGlobusCore.TextFilter(l("#yoast_wpseo_focuskw_text_input").val(),WPGlobusCoreData.default_language,"RETURN_EMPTY");l("#yoast_wpseo_focuskw_text_input").val(e),l("#yoast_wpseo_focuskw").val(e),l(".wpseo-metabox-sidebar .wpseo-meta-section-link").on("click",function(e){"#wpseo-meta-section-content"==l(this).attr("href")?l("#wpglobus-wpseo-tabs").css({display:"block"}):l("#wpglobus-wpseo-tabs").css({display:"none"})}),l("body").on("click","."+r.editSnippetButtonClass,function(e){var t=l(this),a=t.data("language"),s=l("."+r.editSnippetFormClass+"_"+a),o=l("."+r.editSnippetSubmitClass+"_"+a),i=l("."+r.editSnippetHeadingClass+"_"+a);s.hasClass("snippet-editor--hidden")?(s.removeClass("snippet-editor--hidden"),i.removeClass("snippet-editor--hidden"),o.removeClass("snippet-editor--hidden")):(s.addClass("snippet-editor--hidden"),i.addClass("snippet-editor--hidden")),t.addClass("snippet-editor--hidden")}),l("body").on("click","."+r.editSnippetSubmitClass,function(e){var t=l(this).data("language"),a=l("."+r.editSnippetButtonClass+"_"+t),s=l("."+r.editSnippetFormClass+"_"+t),o=l("."+r.editSnippetSubmitClass+"_"+t),i=l("."+r.editSnippetHeadingClass+"_"+t);a.removeClass("snippet-editor--hidden"),s.addClass("snippet-editor--hidden"),o.addClass("snippet-editor--hidden"),i.addClass("snippet-editor--hidden")}),l(document).on("keyup","input.wpglobus-snippet-editor-title",function(e){var t=l(this),a=t.data("language"),s=WPGlobusCore.getString(l('input[name="yoast_wpseo_title"]').val(),t.val(),a);l("#snippet_title_"+a).html(d.replaceVariablesPlugin(t.val())),YoastSEO.app.rawData.pageTitle=s,l('input[name="yoast_wpseo_title"]').val(s),l("#snippet_title").text(s),_.debounce(r.updateProgressBar(t,a),500)}),l(document).on("keyup","input.wpglobus-snippet-editor-slug",function(e){var t=l(this),a=t.data("language");l("#snippet_cite_"+a).text(t.val()+"/"),l("#editable-post-name").text(t.val()),l("#editable-post-name-full").text(t.val())}),l(document).on("change","input.wpglobus-snippet-editor-slug",function(e){var t=l(this);l.post(ajaxurl,{action:"sample-permalink",post_id:l("#post_ID").val()||0,new_slug:t.val(),new_title:l("#title").val(),samplepermalinknonce:l("#samplepermalinknonce").val()})}),l(document).on("keyup","textarea.wpglobus-snippet-editor-meta-description",function(e){var t=l(this),a=t.data("language");l("#snippet_meta_"+a).text(t.val());var s=WPGlobusCore.getString(l("#yoast_wpseo_metadesc").val(),t.val(),t.data("language"));l("#yoast_wpseo_metadesc").val(s),l("#snippet_meta").text(s),_.debounce(r.updateProgressBar(t,a),500)}),l("body").on("click",".wpglobus-post-body-tabs-list li",function(e){var t=l(this);if(t.hasClass("wpglobus-post-tab")){l("#wpglobus-wpseo-tabs").tabs("option","active",t.data("order"));var a=l("#yoast_wpseo_focuskw_text_input_"+l(this).data("language")).val();YoastSEO.app.rawData.keyword=a,l("#yoast_wpseo_focuskw_text_input").val(a),l('input[name="yoast_wpseo_focuskw"]').val(a),s.prototype.analyze()}}),r.initAddKeywordPopup()}},(s=function(){this.replaceVars=wpseoReplaceVarsL10n.replace_vars,this.language=WPGlobusCoreData.default_language,this.tab=WPGlobusCoreData.default_language,this.wpseoTab=WPGlobusCoreData.default_language,this.title_template=wpseoPostScraperL10n.title_template,this.focuskw=l("#yoast_wpseo_focuskw_text_input"),this.focuskw_hidden=l('input[name="yoast_wpseo_focuskw"]'),this.focuskwKeep=!1,this.post_slug="#editable-post-name-full",YoastSEO.app.registerPlugin("wpglobusYoastSeoPlugin",{status:"ready"}),YoastSEO.app.registerModification("content",this.contentModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("title",this.titleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_title",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_meta",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_page_title",this.pageTitleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_meta_desc",this.metaDescModification,"wpglobusYoastSeoPlugin",0),s.prototype.setScoreIcon(),l(document).on("blur",".wpglobus-snippet_title",function(e){var t=l(this),a=WPGlobusCore.getString(l("#yoast_wpseo_title").val(),t.text(),t.data("language"));YoastSEO.app.rawData.pageTitle=a,l('input[name="yoast_wpseo_title"]').val(a),l("#snippet_title").text(a)}),l(document).on("blur",".wpglobus-snippet_meta",function(e){var t=l(this),a=WPGlobusCore.getString(l("#yoast_wpseo_metadesc").val(),t.text(),t.data("language"));l("#yoast_wpseo_metadesc").val(a),l("#snippet_meta").text(a)}),l(document).on("keyup",".wpglobus-yoast_wpseo_focuskw_text_input",function(e){var t=l(this),a=t.val();d.focuskw.val(a),d.focuskw_hidden.val(a),d.updateWpseoKeyword(a,t.data("language")),s.prototype.analyze()}),l("#publish,#save-post").on("mouseenter",function(e){var a,s="";l(".wpglobus-yoast_wpseo_focuskw_text_input").each(function(e,t){a=l(this),s=WPGlobusCore.getString(s,a.val(),a.data("language"))}),d.focuskw.val(s),d.focuskw_hidden.val(s)}).on("mouseleave",function(e){if(!d.focuskwKeep){d.wpseoTab=l(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");l(this);d.focuskw.val(l("#yoast_wpseo_focuskw_text_input_"+d.wpseoTab).val()),d.focuskw_hidden.val(l("#yoast_wpseo_focuskw_text_input_"+d.wpseoTab).val())}}).on("click",function(e){d.focuskwKeep=!0}),l(WPGlobusYoastSeo.wpseoTabSelector).on("tabsactivate",function(e,t){if(d.language=t.newPanel.attr("data-language"),t.newPanel.attr("data-language")===WPGlobusCoreData.default_language){var a=l("#yoast_wpseo_focuskw_text_input_"+WPGlobusCoreData.default_language).val();YoastSEO.app.rawData.keyword=a,d.focuskw.val(a),d.focuskw_hidden.val(a)}s.prototype.analyze()}),d=this}).prototype.analyze=function(){var e=l(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");e==WPGlobusCoreData.default_language?YoastSEO.app.snippetPreview.data.urlPath=l("#editable-post-name-full").text():0!=l("#editable-post-name-full-"+e).length?YoastSEO.app.snippetPreview.data.urlPath=l("#editable-post-name-full-"+e).text():YoastSEO.app.snippetPreview.data.urlPath=l("#editable-post-name-full").text(),YoastSEO.app.analyzeTimer(YoastSEO.app),s.prototype.setScoreIcon()},s.prototype.setScoreIcon=function(){var a;a=setInterval(function(){var e=l(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language"),t=l("#wpseo-metabox-tabs .wpseo-score-icon").attr("class");"bad"!=(t=t.replace("wpseo-score-icon ",""))&&"ok"!=t&&"good"!=t||(l("#wpseo-metabox-tabs_"+e+" .wpseo-score-icon").removeClass("bad ok good 100"),l("#wpseo-metabox-tabs_"+e+" .wpseo-score-icon").addClass(t),clearInterval(a))},700)},s.prototype.getWPseoTab=function(){return l(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language")},s.prototype.citeModification=function(e){var t="#snippet_citeBase_"+e,a="#snippet_cite_"+e,s=l("#wpseo-tab-"+e).data("yoast-cite-base");!1===l("#wpseo-tab-"+e).data("cite-contenteditable")&&l(a).attr("contenteditable","false"),l(t).text(s)},s.prototype.pageTitleModification=function(e){var a,s,o,i="#snippet_title_",n="",p="";if(d.title_template==e)l.each(WPGlobusCoreData.enabled_languages,function(e,t){s=l("#snippet-editor-title_"+t).val(),o=0==s.length?d.title_template:s,n=d.replaceVariablesPlugin(o),l(i+t).text(n),t==d.getWPseoTab()&&(p=n)});else{if(a=WPGlobusCore.getTranslations(e),d.getWPseoTab()!==WPGlobusCoreData.default_language&&a[WPGlobusCoreData.default_language]==e){var t=d.getWPseoTab();return s=l("#snippet-editor-title_"+t).val(),o=0<s.length?s:d.title_template,o=d.replaceVariablesPlugin(o),l(i+t).text(o),o}l.each(WPGlobusCoreData.enabled_languages,function(e,t){n=""===a[t]?d.replaceVariablesPlugin(d.title_template):d.replaceVariablesPlugin(a[t]),t==d.getWPseoTab()&&(p=n,0!=(s=l("#snippet-editor-title_"+t).val()).length?s!=p&&(p=d.replaceVariablesPlugin(s)):p=d.replaceVariablesPlugin(d.title_template)),l(i+t).html(p)})}return p},s.prototype.metaDescModification=function(a){var e,s="#snippet_meta_",t=WPGlobusCore.getTranslations(a),o="";if(e=l("#snippet-editor-meta-description_"+d.getWPseoTab()).val(),d.getWPseoTab()!==WPGlobusCoreData.default_language&&t[WPGlobusCoreData.default_language]==a){var i=d.getWPseoTab();return d.citeModification(i),0==e.length?l(s+i).text(""):e!=a&&l(s+i).text(e),a}return l.each(WPGlobusCoreData.enabled_languages,function(e,t){l(s+t).text(WPGlobusCore.TextFilter(a,t,"RETURN_EMPTY")),d.citeModification(t)}),e==t[d.getWPseoTab()]?0==(o=t[d.getWPseoTab()]).length&&l(s+d.getWPseoTab()).text(WPGlobusCore.TextFilter(YoastSEO.app.snippetPreview.data.metaDesc,WPGlobusCoreData.default_language,"RETURN_EMPTY")):0==(o=e).length?l(s+d.getWPseoTab()).text(WPGlobusCore.TextFilter(YoastSEO.app.snippetPreview.data.metaDesc,WPGlobusCoreData.default_language,"RETURN_EMPTY")):l(s+d.getWPseoTab()).text(o),l(s+d.getWPseoTab()).text(o),o},s.prototype.snippetModification=function(e){return WPGlobusCore.TextFilter(e,d.getWPseoTab(),"RETURN_EMPTY")},s.prototype.contentModification=function(e){return d.getWPseoTab()==WPGlobusCoreData.default_language?e:l("#content_"+d.getWPseoTab()).val()},s.prototype.titleModification=function(e){return setTimeout(d.updatePageAnalysis,1e3),d.getWPseoTab()==WPGlobusCoreData.default_language?e:l("#title_"+d.getWPseoTab()).val()},s.prototype.defaultReplace=function(e){var t=YoastSEO.app.rawData.keyword;return e.replace(/%%sitedesc%%/g,this.replaceVars.sitedesc).replace(/%%sitename%%/g,WPGlobusCore.TextFilter(this.replaceVars.sitename,d.getWPseoTab())).replace(/%%term_title%%/g,this.replaceVars.term_title).replace(/%%term_description%%/g,this.replaceVars.term_description).replace(/%%category_description%%/g,this.replaceVars.category_description).replace(/%%tag_description%%/g,this.replaceVars.tag_description).replace(/%%searchphrase%%/g,this.replaceVars.searchphrase).replace(/%%date%%/g,this.replaceVars.date).replace(/%%id%%/g,this.replaceVars.id).replace(/%%page%%/g,this.replaceVars.page).replace(/%%currenttime%%/g,this.replaceVars.currenttime).replace(/%%currentdate%%/g,this.replaceVars.currentdate).replace(/%%currentday%%/g,this.replaceVars.currentday).replace(/%%currentmonth%%/g,this.replaceVars.currentmonth).replace(/%%currentyear%%/g,this.replaceVars.currentyear).replace(/%%focuskw%%/g,t)},s.prototype.replaceVariablesPlugin=function(e){return void 0!==e&&(e=this.titleReplace(e),e=this.defaultReplace(e),e=this.replaceSeparators(e)),e},s.prototype.replaceSeparators=function(e){return e.replace(/%%sep%%(\s+%%sep%%)*/g,this.replaceVars.sep)},s.prototype.titleReplace=function(e){var t="";return void 0===(t=this.language==WPGlobusCoreData.default_language?l("#title").val():l("#title_"+this.language).val())&&(t=YoastSEO.app.rawData.pageTitle),this.language!=WPGlobusCoreData.default_language&&0==t.length&&(t=l("#title").val()),e=e.replace(/%%title%%/g,t)},s.prototype.doubleSepReplace=function(e){var t=YoastSEO.app.stringHelper.addEscapeChars(this.replaceVars.sep),a=new RegExp(t+" "+t,"g");return e=e.replace(a,this.replaceVars.sep)},s.prototype.updateWpseoKeyword=function(e,t){1==l("#wpseo-meta-section-content_"+t+" .wpseo_keyword").length&&l("#wpseo-meta-section-content_"+t+" .wpseo_keyword").removeClass("wpseo_keyword").addClass("wpglobus-wpseo_keyword_"+t),l(".wpglobus-wpseo_keyword_"+t).text(e)},s.prototype.updatePageAnalysis=function(){l("#wpseo-pageanalysis_"+d.getWPseoTab()).html(l("#wpseo-pageanalysis").html())},window.WPGlobusYoastSeoPlugin=new s}});
includes/js/wpglobus-yoastseo-33.min.js CHANGED
@@ -1 +1 @@
1
- var WPGlobusYoastSeo;jQuery(document).ready(function(e){"use strict";if("undefined"!=typeof wpseoReplaceVarsL10n&&"undefined"!=typeof WPGlobusCoreData&&"undefined"!=typeof WPGlobusVendor){var t;if("edit-tags.php"==WPGlobusVendor.pagenow||"term.php"==WPGlobusVendor.pagenow){t=WPGlobusYoastSeo={editorIDs:["description"],editor:{},submitId:"#submit",preventChangeEditor:!1,observer:null,init:function(){t.attachListeners(),_.delay(t.start,1500)},submit:function(a){"mouseenter"===a.type?e.each(t.editor,function(a,s){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(t.editor[a].content):tinymce.get(a).setContent(t.editor[a].content)}):"mouseleave"===a.type?t.preventChangeEditor||(e.each(t.editor,function(a,s){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(WPGlobusCore.TextFilter(s.content,t.getCurrentTab(),"RETURN_EMPTY")):tinymce.get(a).setContent(WPGlobusCore.TextFilter(s.content,t.getCurrentTab(),"RETURN_EMPTY"))}),t.preventChangeEditor=!1):"click"===a.type&&(t.preventChangeEditor=!0,"tinymce"!=getUserSetting("editor")&&setUserSetting("editor","tinymce"))},attachListeners:function(){e(".wrap").on("tabsactivate",function(a,s){e.each(t.editor,function(a,o){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(WPGlobusCore.TextFilter(o.content,s.newTab[0].dataset.language,"RETURN_EMPTY")):tinymce.get(a).setContent(WPGlobusCore.TextFilter(o.content,s.newTab[0].dataset.language,"RETURN_EMPTY"))})}),e(document).on("mouseenter",t.submitId,t.submit).on("mouseleave",t.submitId,t.submit).on("click",t.submitId,t.submit),e(document).on("tinymce-editor-init",function(a,s){if(-1!=_.indexOf(t.editorIDs,s.id)){var o=e("#"+s.id);t.editor[s.id]={},t.editor[s.id].contentEditor=s,t.editor[s.id].content=o.val(),s.setContent(WPGlobusCore.TextFilter(t.editor[s.id].content,WPGlobusCoreData.default_language,"RETURN_EMPTY")),e("#"+s.getContainer().id).find("iframe").addClass("wpglobus-translatable"),o.removeClass("hidden"),s.on("nodechange keyup",_.debounce(t.update,500)),o.on("input keyup",_.debounce(t.update,500))}})},update:function(a){var s,o;void 0!==a.target&&("tinymce"==(s=a.target.id)&&(s=a.target.dataset.id),void 0!==t.editor[s].contentEditor&&(o=!t.editor[s].contentEditor||t.editor[s].contentEditor.isHidden()?e("#"+s).val():t.editor[s].contentEditor.getContent({format:"raw"}),t.editor[s].content=WPGlobusCore.getString(t.editor[s].content,o,t.getCurrentTab())))},getCurrentTab:function(){return e(".wpglobus-taxonomy-tabs-list .ui-tabs-active").data("language")},start:function(){e(".wpglobus-element_description").css({display:"none"})}},WPGlobusYoastSeo.init();var a=function(){e(".wrap").on("tabsactivate",function(t,a){a.newTab[0].dataset.language==WPGlobusCoreData.default_language?e("#poststuff .inside").css({display:"block"}):e("#poststuff .inside").css({display:"none"})}),e.each(["category_description","sitedesc","sitename","tag_description","term_description","term_title"],function(e,t){wpseoReplaceVarsL10n.replace_vars[t]=WPGlobusCore.TextFilter(wpseoReplaceVarsL10n.replace_vars[t],WPGlobusCoreData.default_language)}),WPGlobusYoastSeo.observer=new MutationObserver(function(t){t.forEach(function(t){if("placeholder"==t.attributeName){WPGlobusYoastSeo.observer.disconnect();var a=e("#wpseo_focuskw");""==a.val()&&a.attr("placeholder",WPGlobusCore.TextFilter(a.attr("placeholder"),WPGlobusCoreData.default_language)),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})}})}),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})};window.WPGlobusYoastSeoPlugin=new a}else{t=WPGlobusYoastSeo={wpseoTabSelector:"#wpglobus-wpseo-tabs",url:"",attrs:e("#wpglobus-wpseo-attr"),iB:e("#wpseo-meta-section-content"),t:e("#wpseo-meta-section-content"),ids:"",names:"",editSnippetButtonClass:"wpglobus-snippet-editor__edit-button",editSnippetFormClass:"wpglobus-snippet-editor__form",editSnippetSubmitClass:"wpglobus-snippet-editor__submit",editSnippetHeadingClass:"wpglobus-snippet-editor__heading-editor",yoastTitleProgress:"wpglobus-yoast-title-progress",yoastMetadescProgress:"wpglobus-yoast-metadesc-progress",init:function(){t.start()},initAddKeywordPopup:function(){1===e("#wpseo-add-keyword-popup").length&&e(".wpseo-add-keyword").on("click",t.addKeywordPopup)},addKeywordPopup:function(){var t=e("#wpseo-add-keyword-popup-button").text();tb_show(t,"#TB_inline?width=650&height=350&inlineId=wpseo-add-keyword-popup","group"),jQuery("#TB_window").css("height",235),jQuery("#TB_window").css("width",680)},qtip:function(){e(".yoast_help").qtip({content:{attr:"alt"},position:{my:"bottom left",at:"top center"},style:{tip:{corner:!0},classes:"yoast-qtip qtip-rounded qtip-blue"},show:"click",hide:{fixed:!0,delay:500}})},removeClasses:function(e,t){_.each(t,function(t){e.removeClass(t)})},updateProgressBar:function(a,s){if(void 0!==a&&(void 0!==s||("undefined"!==a.data("language")&&(s=a.data("language")),void 0!==s))){var o,i=["snippet-editor__progress--bad","snippet-editor__progress--ok","snippet-editor__progress--good"],n=0,l="",p=0,r=!1;n=a.val().length,a.hasClass("wpglobus-snippet-editor-title")?(p=(o=e("progress."+t.yoastTitleProgress+"_"+s)).attr("max"),l=i[2],0==n?l=i[1]:n>p?(l=i[1],r=!0):n>0&&n<35&&(l=i[1])):a.hasClass("wpglobus-snippet-editor-meta-description")&&(p=(o=e("progress."+t.yoastMetadescProgress+"_"+s)).attr("max"),l=i[2],0==n?l=i[1]:n>p?(l=i[1],r=!0):n>0&&n<121&&(l=i[1])),t.removeClasses(o,i),o.attr("value",n).addClass(l),r?a.css("color","#f00"):a.css("color","#000")}},updateWpseoKeyword:function(t,a){e("#wpseo-meta-section-content_"+a+" .wpseo-keyword").eq(1).text(t)},start:function(){e(t.wpseoTabSelector).tabs(),t.ids=t.attrs.data("ids"),t.names=t.attrs.data("names"),t.ids=t.ids+","+t.attrs.data("qtip"),t.ids=t.ids.split(","),t.names=t.names.split(","),e("#wpglobus-wpseo-tabs").insertBefore(t.iB),e(".wpseo-metabox-tabs").css({height:"26px"}),e(".wpglobus-wpseo-general").each(function(a,s){var o=e(s),i=o.data("language"),n="wpseo-meta-section-content_"+i;o.html('<div id="'+n+'" class="wpseo-meta-section wpglobus-wpseo-meta-section" style="width:100%" data-language="'+i+'">'+t.t.html()+"</div>"),e("#"+n+" .wpseo-metabox-tabs").attr("id","wpseo-metabox-tabs_"+i).attr("data-language",i),e("#"+n+" .wpseotab").attr("id","wpseo_content_"+i),e("#wpseo_content_"+i).css({float:"left"}),e("#"+n).css({display:"block"}),e("#wpseo_meta").css({overflow:"hidden"}),e("#"+n+" .snippet_container").addClass("wpglobus-snippet_container"),i!==WPGlobusCoreData.default_language&&e("#"+n+" .wpseo-add-keyword").addClass("hidden"),e.each(t.names,function(t,a){e("#"+a).attr("name",a+"_"+i)}),e.each(t.ids,function(a,s){var o=e("#"+s);"wpseosnippet"==s&&o.addClass("wpglobus-wpseosnippet"),"snippet_title"==s&&o.addClass("wpglobus-snippet_title"),"snippet_meta"==s&&o.addClass("wpglobus-snippet_meta"),"snippet_cite"==s&&o.addClass("wpglobus-snippet_cite"),"snippet_citeBase"==s&&o.addClass("wpglobus-snippet_citeBase"),"url_container"==s&&o.css({height:"16px"}),"yoast_wpseo_focuskw_text_input"==s&&o.addClass("wpglobus-yoast_wpseo_focuskw_text_input"),"wpseo-pageanalysis"==s&&o.addClass("wpglobus-wpseo-pageanalysis"),"yoast-seo-content-analysis"==s&&o.addClass("wpglobus-yoast-seo-content-analysis"),"snippet_preview"==s&&o.addClass("wpglobus-snippet_preview"),"snippet-editor-title"==s&&(o.addClass("wpglobus-snippet-editor-title"),o.parent("label").attr("for",o.parent("label").attr("for")+"_"+i),o.val(e("#wpseo-tab-"+i).data("wpseotitle")),o.parent("label").next("progress").addClass(t.yoastTitleProgress).addClass(t.yoastTitleProgress+"_"+i),_.debounce(t.updateProgressBar(o,i),500)),"snippet-editor-slug"==s&&(o.addClass("wpglobus-snippet-editor-slug"),o.parent("label").attr("for",o.parent("label").attr("for")+"_"+i),WPGlobusCoreData.default_language!=i&&o.attr("disabled","disabled")),"snippet-editor-meta-description"==s&&(o.addClass("wpglobus-snippet-editor-meta-description"),o.parent("label").attr("for",o.parent("label").attr("for")+"_"+i),o.val(e("#wpseo-tab-"+i).data("metadesc")),o.parent("label").next("progress").addClass(t.yoastMetadescProgress).addClass(t.yoastMetadescProgress+"_"+i),_.debounce(t.updateProgressBar(o,i),500)),"snippetpreview-help-toggle"==s&&(o.addClass("wpglobus-snippetpreview-help-toggle_"+i),e(document).on("click",".wpglobus-snippetpreview-help-toggle_"+i,function(t){var a=e(this);"none"===e("#snippetpreview-help_"+a.data("language")).css("display")?e("#snippetpreview-help_"+a.data("language")).css({display:"block"}):e("#snippetpreview-help_"+a.data("language")).css({display:"none"})})),"focuskw_text_input-help-toggle"==s&&(o.addClass("wpglobus-focuskw_text_input-help-toggle_"+i),e(document).on("click",".wpglobus-focuskw_text_input-help-toggle_"+i,function(t){var a=e(this);"none"===e("#focuskw_text_input-help_"+a.data("language")).css("display")?e("#focuskw_text_input-help_"+a.data("language")).css({display:"block"}):e("#focuskw_text_input-help_"+a.data("language")).css({display:"none"})})),"pageanalysis-help-toggle"==s&&(o.addClass("wpglobus-pageanalysis-help-toggle_"+i),e(document).on("click",".wpglobus-pageanalysis-help-toggle_"+i,function(t){var a=e(this);"none"===e("#pageanalysis-help_"+a.data("language")).css("display")?e("#pageanalysis-help_"+a.data("language")).css({display:"block"}):e("#pageanalysis-help_"+a.data("language")).css({display:"none"})})),o.attr("id",s+"_"+i),e("#"+s+"_"+i).attr("data-language",i)});var l=WPGlobusCore.TextFilter(e("#yoast_wpseo_focuskw_text_input").val(),i,"RETURN_EMPTY");e("#yoast_wpseo_focuskw_text_input_"+i).val(l),e("#yoast_wpseo_focuskw_"+i).val(l),t.updateWpseoKeyword(l,i),i!==WPGlobusCoreData.default_language&&(e("#"+n+" #yoast_wpseo_focuskw_text_input_"+i).addClass("hidden").after('<div class="wpglobus-suggest" style="font-weight:bold;">'+WPGlobusVendor.i18n.yoastseo_plus_access+"</div>"),e("#"+n+" #wpseo-pageanalysis_"+i).addClass("hidden").css({display:"none"}))}),e(".wpglobus-wpseosnippet").each(function(a,s){var o=e(s),i=o.data("language");o.find("button.snippet-editor__button.snippet-editor__edit-button").addClass(t.editSnippetButtonClass).addClass(t.editSnippetButtonClass+"_"+i).attr("data-language",i),o.find(".snippet-editor__form").addClass(t.editSnippetFormClass).addClass(t.editSnippetFormClass+"_"+i),o.find(".snippet-editor__heading-editor").addClass(t.editSnippetHeadingClass).addClass(t.editSnippetHeadingClass+"_"+i),o.find(".snippet-editor__submit").addClass(t.editSnippetSubmitClass).addClass(t.editSnippetSubmitClass+"_"+i).attr("data-language",i)}),t.iB.addClass("hidden"),t.iB.css({height:0,overflow:"hidden"});var o=WPGlobusCore.TextFilter(e("#yoast_wpseo_focuskw_text_input").val(),WPGlobusCoreData.default_language,"RETURN_EMPTY");e("#yoast_wpseo_focuskw_text_input").val(o),e("#yoast_wpseo_focuskw").val(o),e(".wpglobus-wpseo-general .wpseo_tablink").on("click",function(t){t.preventDefault();var a=e(this),s=a.parents("ul").data("language"),o=a.parent("li");s!=WPGlobusCoreData.default_language&&void 0===e(document).triggerHandler("wpglobus_yoast_analysis",{language:s})||(o.hasClass("wpseo_content_tab")?(e("#wpseo-pageanalysis_"+s).css({display:"none"}),e("#yoast-seo-content-analysis_"+s).css({display:"block"}),e("#wpseo_content_"+s+" table tr").eq(0).css({display:"none"}),e("#wpseo_content_"+s+" table tr").eq(1).css({display:"none"}),e("#yoast-seo-content-analysis_"+s+" li a").css({float:"none"})):o.hasClass("wpseo_keyword_tab")&&(e("#wpseo-pageanalysis_"+s).css({display:"block"}),e("#yoast-seo-content-analysis_"+s).css({display:"none"}),e("#wpseo_content_"+s+" table tr").eq(0).css("display",""),e("#wpseo_content_"+s+" table tr").eq(1).css("display","")))}),e(".wpseo-metabox-sidebar .wpseo-meta-section-link").on("click",function(t){"#wpseo-meta-section-content"==e(this).attr("href")?e("#wpglobus-wpseo-tabs").css({display:"block"}):e("#wpglobus-wpseo-tabs").css({display:"none"})}),e("body").on("click","."+t.editSnippetButtonClass,function(a){var s=e(this),o=s.data("language"),i=e("."+t.editSnippetFormClass+"_"+o),n=e("."+t.editSnippetSubmitClass+"_"+o),l=e("."+t.editSnippetHeadingClass+"_"+o);i.hasClass("snippet-editor--hidden")?(i.removeClass("snippet-editor--hidden"),l.removeClass("snippet-editor--hidden"),n.removeClass("snippet-editor--hidden")):(i.addClass("snippet-editor--hidden"),l.addClass("snippet-editor--hidden")),s.addClass("snippet-editor--hidden")}),e("body").on("click","."+t.editSnippetSubmitClass,function(a){var s=e(this).data("language"),o=e("."+t.editSnippetButtonClass+"_"+s),i=e("."+t.editSnippetFormClass+"_"+s),n=e("."+t.editSnippetSubmitClass+"_"+s),l=e("."+t.editSnippetHeadingClass+"_"+s);o.removeClass("snippet-editor--hidden"),i.addClass("snippet-editor--hidden"),n.addClass("snippet-editor--hidden"),l.addClass("snippet-editor--hidden")}),e(document).on("keyup","input.wpglobus-snippet-editor-title",function(a){var o=e(this),i=o.data("language"),n=WPGlobusCore.getString(e('input[name="yoast_wpseo_title"]').val(),o.val(),i);e("#snippet_title_"+i).html(s.replaceVariablesPlugin(o.val())),YoastSEO.app.rawData.pageTitle=n,e('input[name="yoast_wpseo_title"]').val(n),e("#snippet_title").text(n),_.debounce(t.updateProgressBar(o,i),500)}),e(document).on("keyup","input.wpglobus-snippet-editor-slug",function(t){var a=e(this),s=a.data("language");e("#snippet_cite_"+s).text(a.val()+"/"),e("#editable-post-name").text(a.val()),e("#editable-post-name-full").text(a.val())}),e(document).on("change","input.wpglobus-snippet-editor-slug",function(t){var a=e(this);e.post(ajaxurl,{action:"sample-permalink",post_id:e("#post_ID").val()||0,new_slug:a.val(),new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()})}),e(document).on("keyup","textarea.wpglobus-snippet-editor-meta-description",function(a){var s=e(this),o=s.data("language");e("#snippet_meta_"+o).text(s.val());var i=WPGlobusCore.getString(e("#yoast_wpseo_metadesc").val(),s.val(),s.data("language"));e("#yoast_wpseo_metadesc").val(i),e("#snippet_meta").text(i),_.debounce(t.updateProgressBar(s,o),500)}),e("body").on("click",".wpglobus-post-body-tabs-list li",function(t){var s=e(this);if(s.hasClass("wpglobus-post-tab")){e("#wpglobus-wpseo-tabs").tabs("option","active",s.data("order"));var o=e("#yoast_wpseo_focuskw_text_input_"+e(this).data("language")).val();YoastSEO.app.rawData.keyword=o,e("#yoast_wpseo_focuskw_text_input").val(o),e('input[name="yoast_wpseo_focuskw"]').val(o),a.prototype.analyze()}}),t.initAddKeywordPopup()}};var s;(a=function(){this.replaceVars=wpseoReplaceVarsL10n.replace_vars,this.language=WPGlobusCoreData.default_language,this.tab=WPGlobusCoreData.default_language,this.wpseoTab=WPGlobusCoreData.default_language,this.title_template=wpseoPostScraperL10n.title_template,this.focuskw=e("#yoast_wpseo_focuskw_text_input"),this.focuskw_hidden=e('input[name="yoast_wpseo_focuskw"]'),this.focuskwKeep=!1,this.post_slug="#editable-post-name-full",YoastSEO.app.registerPlugin("wpglobusYoastSeoPlugin",{status:"ready"}),YoastSEO.app.registerModification("content",this.contentModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("title",this.titleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_title",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_meta",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_page_title",this.pageTitleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_meta_desc",this.metaDescModification,"wpglobusYoastSeoPlugin",0),a.prototype.setScoreIcon(),e(document).on("blur",".wpglobus-snippet_title",function(t){var a=e(this),s=WPGlobusCore.getString(e("#yoast_wpseo_title").val(),a.text(),a.data("language"));YoastSEO.app.rawData.pageTitle=s,e('input[name="yoast_wpseo_title"]').val(s),e("#snippet_title").text(s)}),e(document).on("blur",".wpglobus-snippet_meta",function(t){var a=e(this),s=WPGlobusCore.getString(e("#yoast_wpseo_metadesc").val(),a.text(),a.data("language"));e("#yoast_wpseo_metadesc").val(s),e("#snippet_meta").text(s)}),e(document).on("keyup",".wpglobus-yoast_wpseo_focuskw_text_input",function(t){var o=e(this),i=o.val();s.focuskw.val(i),s.focuskw_hidden.val(i),s.updateWpseoKeyword(i,o.data("language")),a.prototype.analyze()}),e("#publish,#save-post").on("mouseenter",function(t){var a,o="";e(".wpglobus-yoast_wpseo_focuskw_text_input").each(function(t,s){a=e(this),o=WPGlobusCore.getString(o,a.val(),a.data("language"))}),s.focuskw.val(o),s.focuskw_hidden.val(o)}).on("mouseleave",function(t){if(!s.focuskwKeep){s.wpseoTab=e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");e(this);s.focuskw.val(e("#yoast_wpseo_focuskw_text_input_"+s.wpseoTab).val()),s.focuskw_hidden.val(e("#yoast_wpseo_focuskw_text_input_"+s.wpseoTab).val())}}).on("click",function(e){s.focuskwKeep=!0}),e(WPGlobusYoastSeo.wpseoTabSelector).on("tabsactivate",function(t,o){if(s.language=o.newPanel.attr("data-language"),o.newPanel.attr("data-language")===WPGlobusCoreData.default_language){var i=e("#yoast_wpseo_focuskw_text_input_"+WPGlobusCoreData.default_language).val();YoastSEO.app.rawData.keyword=i,s.focuskw.val(i),s.focuskw_hidden.val(i)}a.prototype.analyze()}),s=this}).prototype.analyze=function(){var t=e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");t==WPGlobusCoreData.default_language?YoastSEO.app.snippetPreview.data.urlPath=e("#editable-post-name-full").text():0!=e("#editable-post-name-full-"+t).length?YoastSEO.app.snippetPreview.data.urlPath=e("#editable-post-name-full-"+t).text():YoastSEO.app.snippetPreview.data.urlPath=e("#editable-post-name-full").text(),YoastSEO.app.analyzeTimer(YoastSEO.app),a.prototype.setScoreIcon()},a.prototype.setScoreIcon=function(){var t;t=setInterval(function(){var a=e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language"),s=e("#wpseo-metabox-tabs .wpseo-score-icon").attr("class");"bad"!=(s=s.replace("wpseo-score-icon ",""))&&"ok"!=s&&"good"!=s||(e("#wpseo-metabox-tabs_"+a+" .wpseo-score-icon").removeClass("bad ok good 100"),e("#wpseo-metabox-tabs_"+a+" .wpseo-score-icon").addClass(s),clearInterval(t))},700)},a.prototype.getWPseoTab=function(){return e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language")},a.prototype.citeModification=function(t){var a="#snippet_citeBase_"+t,s="#snippet_cite_"+t,o=e("#wpseo-tab-"+t).data("yoast-cite-base");!1===e("#wpseo-tab-"+t).data("cite-contenteditable")&&e(s).attr("contenteditable","false"),e(a).text(o)},a.prototype.pageTitleModification=function(t){var a,o,i,n="#snippet_title_",l="",p="";if(s.title_template==t)e.each(WPGlobusCoreData.enabled_languages,function(t,a){o=e("#snippet-editor-title_"+a).val(),i=0==o.length?s.title_template:o,l=s.replaceVariablesPlugin(i),e(n+a).text(l),a==s.getWPseoTab()&&(p=l)});else{if(a=WPGlobusCore.getTranslations(t),s.getWPseoTab()!==WPGlobusCoreData.default_language&&a[WPGlobusCoreData.default_language]==t){var r=s.getWPseoTab();return o=e("#snippet-editor-title_"+r).val(),i=o.length>0?o:s.title_template,i=s.replaceVariablesPlugin(i),e(n+r).text(i),i}e.each(WPGlobusCoreData.enabled_languages,function(t,i){l=""===a[i]?s.replaceVariablesPlugin(s.title_template):s.replaceVariablesPlugin(a[i]),i==s.getWPseoTab()&&(p=l,0!=(o=e("#snippet-editor-title_"+i).val()).length?o!=p&&(p=s.replaceVariablesPlugin(o)):p=s.replaceVariablesPlugin(s.title_template)),e(n+i).html(p)})}return p},a.prototype.metaDescModification=function(t){var a="#snippet_meta_",o="",i=WPGlobusCore.getTranslations(t),n="";if(o=e("#snippet-editor-meta-description_"+s.getWPseoTab()).val(),s.getWPseoTab()!==WPGlobusCoreData.default_language&&i[WPGlobusCoreData.default_language]==t){var l=s.getWPseoTab();return s.citeModification(l),0==o.length?e(a+l).text(""):o!=t&&e(a+l).text(o),t}return e.each(WPGlobusCoreData.enabled_languages,function(o,i){e(a+i).text(WPGlobusCore.TextFilter(t,i,"RETURN_EMPTY")),s.citeModification(i)}),o==i[s.getWPseoTab()]?0==(n=i[s.getWPseoTab()]).length&&e(a+s.getWPseoTab()).text(WPGlobusCore.TextFilter(YoastSEO.app.snippetPreview.data.metaDesc,WPGlobusCoreData.default_language,"RETURN_EMPTY")):0==(n=o).length?e(a+s.getWPseoTab()).text(WPGlobusCore.TextFilter(YoastSEO.app.snippetPreview.data.metaDesc,WPGlobusCoreData.default_language,"RETURN_EMPTY")):e(a+s.getWPseoTab()).text(n),e(a+s.getWPseoTab()).text(n),n},a.prototype.snippetModification=function(e){return WPGlobusCore.TextFilter(e,s.getWPseoTab(),"RETURN_EMPTY")},a.prototype.contentModification=function(t){return s.getWPseoTab()==WPGlobusCoreData.default_language?t:e("#content_"+s.getWPseoTab()).val()},a.prototype.titleModification=function(t){return setTimeout(s.updatePageAnalysis,1e3),s.getWPseoTab()==WPGlobusCoreData.default_language?t:e("#title_"+s.getWPseoTab()).val()},a.prototype.defaultReplace=function(e){var t=YoastSEO.app.rawData.keyword;return e.replace(/%%sitedesc%%/g,this.replaceVars.sitedesc).replace(/%%sitename%%/g,WPGlobusCore.TextFilter(this.replaceVars.sitename,s.getWPseoTab())).replace(/%%term_title%%/g,this.replaceVars.term_title).replace(/%%term_description%%/g,this.replaceVars.term_description).replace(/%%category_description%%/g,this.replaceVars.category_description).replace(/%%tag_description%%/g,this.replaceVars.tag_description).replace(/%%searchphrase%%/g,this.replaceVars.searchphrase).replace(/%%date%%/g,this.replaceVars.date).replace(/%%id%%/g,this.replaceVars.id).replace(/%%page%%/g,this.replaceVars.page).replace(/%%currenttime%%/g,this.replaceVars.currenttime).replace(/%%currentdate%%/g,this.replaceVars.currentdate).replace(/%%currentday%%/g,this.replaceVars.currentday).replace(/%%currentmonth%%/g,this.replaceVars.currentmonth).replace(/%%currentyear%%/g,this.replaceVars.currentyear).replace(/%%focuskw%%/g,t)},a.prototype.replaceVariablesPlugin=function(e){return void 0!==e&&(e=this.titleReplace(e),e=this.defaultReplace(e),e=this.replaceSeparators(e)),e},a.prototype.replaceSeparators=function(e){return e.replace(/%%sep%%(\s+%%sep%%)*/g,this.replaceVars.sep)},a.prototype.titleReplace=function(t){var a="";return void 0===(a=this.language==WPGlobusCoreData.default_language?e("#title").val():e("#title_"+this.language).val())&&(a=YoastSEO.app.rawData.pageTitle),this.language!=WPGlobusCoreData.default_language&&0==a.length&&(a=e("#title").val()),t=t.replace(/%%title%%/g,a)},a.prototype.doubleSepReplace=function(e){var t=YoastSEO.app.stringHelper.addEscapeChars(this.replaceVars.sep),a=new RegExp(t+" "+t,"g");return e=e.replace(a,this.replaceVars.sep)},a.prototype.updateWpseoKeyword=function(t,a){e("#wpseo-meta-section-content_"+a+" .wpseo-keyword").length>0&&e("#wpseo-meta-section-content_"+a+" .wpseo-keyword").eq(1).removeClass("wpseo-keyword").addClass("wpglobus-wpseo_keyword_"+a),e(".wpglobus-wpseo_keyword_"+a).text(t)},a.prototype.updatePageAnalysis=function(){e("#wpseo-pageanalysis_"+s.getWPseoTab()).html(e("#wpseo-pageanalysis").html()),e("#yoast-seo-content-analysis_"+s.getWPseoTab()).html(e("#yoast-seo-content-analysis").html()),e("#yoast-seo-content-analysis_"+s.getWPseoTab()+" li a").css({float:"none"})},window.WPGlobusYoastSeoPlugin=new a}}});
1
+ var WPGlobusYoastSeo;jQuery(document).ready(function(p){"use strict";var r;if("undefined"!=typeof wpseoReplaceVarsL10n&&("undefined"!=typeof WPGlobusCoreData&&"undefined"!=typeof WPGlobusVendor))if("edit-tags.php"==WPGlobusVendor.pagenow||"term.php"==WPGlobusVendor.pagenow){r=WPGlobusYoastSeo={editorIDs:["description"],editor:{},submitId:"#submit",preventChangeEditor:!1,observer:null,init:function(){r.attachListeners(),_.delay(r.start,1500)},submit:function(e){"mouseenter"===e.type?p.each(r.editor,function(e,t){!r.editor[e].contentEditor||r.editor[e].contentEditor.isHidden()?p("#"+e).val(r.editor[e].content):tinymce.get(e).setContent(r.editor[e].content)}):"mouseleave"===e.type?r.preventChangeEditor||(p.each(r.editor,function(e,t){!r.editor[e].contentEditor||r.editor[e].contentEditor.isHidden()?p("#"+e).val(WPGlobusCore.TextFilter(t.content,r.getCurrentTab(),"RETURN_EMPTY")):tinymce.get(e).setContent(WPGlobusCore.TextFilter(t.content,r.getCurrentTab(),"RETURN_EMPTY"))}),r.preventChangeEditor=!1):"click"===e.type&&(r.preventChangeEditor=!0,"tinymce"!=getUserSetting("editor")&&setUserSetting("editor","tinymce"))},attachListeners:function(){p(".wrap").on("tabsactivate",function(e,a){p.each(r.editor,function(e,t){!r.editor[e].contentEditor||r.editor[e].contentEditor.isHidden()?p("#"+e).val(WPGlobusCore.TextFilter(t.content,a.newTab[0].dataset.language,"RETURN_EMPTY")):tinymce.get(e).setContent(WPGlobusCore.TextFilter(t.content,a.newTab[0].dataset.language,"RETURN_EMPTY"))})}),p(document).on("mouseenter",r.submitId,r.submit).on("mouseleave",r.submitId,r.submit).on("click",r.submitId,r.submit),p(document).on("tinymce-editor-init",function(e,t){if(-1!=_.indexOf(r.editorIDs,t.id)){var a=p("#"+t.id);r.editor[t.id]={},r.editor[t.id].contentEditor=t,r.editor[t.id].content=a.val(),t.setContent(WPGlobusCore.TextFilter(r.editor[t.id].content,WPGlobusCoreData.default_language,"RETURN_EMPTY")),p("#"+t.getContainer().id).find("iframe").addClass("wpglobus-translatable"),a.removeClass("hidden"),t.on("nodechange keyup",_.debounce(r.update,500)),a.on("input keyup",_.debounce(r.update,500))}})},update:function(e){var t,a;void 0!==e.target&&("tinymce"==(t=e.target.id)&&(t=e.target.dataset.id),void 0!==r.editor[t].contentEditor&&(a=!r.editor[t].contentEditor||r.editor[t].contentEditor.isHidden()?p("#"+t).val():r.editor[t].contentEditor.getContent({format:"raw"}),r.editor[t].content=WPGlobusCore.getString(r.editor[t].content,a,r.getCurrentTab())))},getCurrentTab:function(){return p(".wpglobus-taxonomy-tabs-list .ui-tabs-active").data("language")},start:function(){p(".wpglobus-element_description").css({display:"none"})}},WPGlobusYoastSeo.init();var s=function(){p(".wrap").on("tabsactivate",function(e,t){t.newTab[0].dataset.language==WPGlobusCoreData.default_language?p("#poststuff .inside").css({display:"block"}):p("#poststuff .inside").css({display:"none"})}),p.each(["category_description","sitedesc","sitename","tag_description","term_description","term_title"],function(e,t){wpseoReplaceVarsL10n.replace_vars[t]=WPGlobusCore.TextFilter(wpseoReplaceVarsL10n.replace_vars[t],WPGlobusCoreData.default_language)}),WPGlobusYoastSeo.observer=new MutationObserver(function(e){e.forEach(function(e){if("placeholder"==e.attributeName){WPGlobusYoastSeo.observer.disconnect();var t=p("#wpseo_focuskw");""==t.val()&&t.attr("placeholder",WPGlobusCore.TextFilter(t.attr("placeholder"),WPGlobusCoreData.default_language)),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})}})}),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})};window.WPGlobusYoastSeoPlugin=new s}else{var d;r=WPGlobusYoastSeo={wpseoTabSelector:"#wpglobus-wpseo-tabs",url:"",attrs:p("#wpglobus-wpseo-attr"),iB:p("#wpseo-meta-section-content"),t:p("#wpseo-meta-section-content"),ids:"",names:"",editSnippetButtonClass:"wpglobus-snippet-editor__edit-button",editSnippetFormClass:"wpglobus-snippet-editor__form",editSnippetSubmitClass:"wpglobus-snippet-editor__submit",editSnippetHeadingClass:"wpglobus-snippet-editor__heading-editor",yoastTitleProgress:"wpglobus-yoast-title-progress",yoastMetadescProgress:"wpglobus-yoast-metadesc-progress",init:function(){r.start()},initAddKeywordPopup:function(){1===p("#wpseo-add-keyword-popup").length&&p(".wpseo-add-keyword").on("click",r.addKeywordPopup)},addKeywordPopup:function(){var e=p("#wpseo-add-keyword-popup-button").text();tb_show(e,"#TB_inline?width=650&height=350&inlineId=wpseo-add-keyword-popup","group"),jQuery("#TB_window").css("height",235),jQuery("#TB_window").css("width",680)},qtip:function(){p(".yoast_help").qtip({content:{attr:"alt"},position:{my:"bottom left",at:"top center"},style:{tip:{corner:!0},classes:"yoast-qtip qtip-rounded qtip-blue"},show:"click",hide:{fixed:!0,delay:500}})},removeClasses:function(t,e){_.each(e,function(e){t.removeClass(e)})},updateProgressBar:function(e,t){if(void 0!==e&&(void 0!==t||("undefined"!==e.data("language")&&(t=e.data("language")),void 0!==t))){var a,s,o=["snippet-editor__progress--bad","snippet-editor__progress--ok","snippet-editor__progress--good"],i="",n=0,l=!1;s=e.val().length,e.hasClass("wpglobus-snippet-editor-title")?(n=(a=p("progress."+r.yoastTitleProgress+"_"+t)).attr("max"),i=o[2],0==s?i=o[1]:n<s?(i=o[1],l=!0):0<s&&s<35&&(i=o[1])):e.hasClass("wpglobus-snippet-editor-meta-description")&&(n=(a=p("progress."+r.yoastMetadescProgress+"_"+t)).attr("max"),i=o[2],0==s?i=o[1]:n<s?(i=o[1],l=!0):0<s&&s<121&&(i=o[1])),r.removeClasses(a,o),a.attr("value",s).addClass(i),l?e.css("color","#f00"):e.css("color","#000")}},updateWpseoKeyword:function(e,t){p("#wpseo-meta-section-content_"+t+" .wpseo-keyword").eq(1).text(e)},start:function(){p(r.wpseoTabSelector).tabs(),r.ids=r.attrs.data("ids"),r.names=r.attrs.data("names"),r.ids=r.ids+","+r.attrs.data("qtip"),r.ids=r.ids.split(","),r.names=r.names.split(","),p("#wpglobus-wpseo-tabs").insertBefore(r.iB),p(".wpseo-metabox-tabs").css({height:"26px"}),p(".wpglobus-wpseo-general").each(function(e,t){var a=p(t),s=a.data("language"),o="wpseo-meta-section-content_"+s;a.html('<div id="'+o+'" class="wpseo-meta-section wpglobus-wpseo-meta-section" style="width:100%" data-language="'+s+'">'+r.t.html()+"</div>"),p("#"+o+" .wpseo-metabox-tabs").attr("id","wpseo-metabox-tabs_"+s).attr("data-language",s),p("#"+o+" .wpseotab").attr("id","wpseo_content_"+s),p("#wpseo_content_"+s).css({float:"left"}),p("#"+o).css({display:"block"}),p("#wpseo_meta").css({overflow:"hidden"}),p("#"+o+" .snippet_container").addClass("wpglobus-snippet_container"),s!==WPGlobusCoreData.default_language&&p("#"+o+" .wpseo-add-keyword").addClass("hidden"),p.each(r.names,function(e,t){p("#"+t).attr("name",t+"_"+s)}),p.each(r.ids,function(e,t){var a=p("#"+t);"wpseosnippet"==t&&a.addClass("wpglobus-wpseosnippet"),"snippet_title"==t&&a.addClass("wpglobus-snippet_title"),"snippet_meta"==t&&a.addClass("wpglobus-snippet_meta"),"snippet_cite"==t&&a.addClass("wpglobus-snippet_cite"),"snippet_citeBase"==t&&a.addClass("wpglobus-snippet_citeBase"),"url_container"==t&&a.css({height:"16px"}),"yoast_wpseo_focuskw_text_input"==t&&a.addClass("wpglobus-yoast_wpseo_focuskw_text_input"),"wpseo-pageanalysis"==t&&a.addClass("wpglobus-wpseo-pageanalysis"),"yoast-seo-content-analysis"==t&&a.addClass("wpglobus-yoast-seo-content-analysis"),"snippet_preview"==t&&a.addClass("wpglobus-snippet_preview"),"snippet-editor-title"==t&&(a.addClass("wpglobus-snippet-editor-title"),a.parent("label").attr("for",a.parent("label").attr("for")+"_"+s),a.val(p("#wpseo-tab-"+s).data("wpseotitle")),a.parent("label").next("progress").addClass(r.yoastTitleProgress).addClass(r.yoastTitleProgress+"_"+s),_.debounce(r.updateProgressBar(a,s),500)),"snippet-editor-slug"==t&&(a.addClass("wpglobus-snippet-editor-slug"),a.parent("label").attr("for",a.parent("label").attr("for")+"_"+s),WPGlobusCoreData.default_language!=s&&a.attr("disabled","disabled")),"snippet-editor-meta-description"==t&&(a.addClass("wpglobus-snippet-editor-meta-description"),a.parent("label").attr("for",a.parent("label").attr("for")+"_"+s),a.val(p("#wpseo-tab-"+s).data("metadesc")),a.parent("label").next("progress").addClass(r.yoastMetadescProgress).addClass(r.yoastMetadescProgress+"_"+s),_.debounce(r.updateProgressBar(a,s),500)),"snippetpreview-help-toggle"==t&&(a.addClass("wpglobus-snippetpreview-help-toggle_"+s),p(document).on("click",".wpglobus-snippetpreview-help-toggle_"+s,function(e){var t=p(this);"none"===p("#snippetpreview-help_"+t.data("language")).css("display")?p("#snippetpreview-help_"+t.data("language")).css({display:"block"}):p("#snippetpreview-help_"+t.data("language")).css({display:"none"})})),"focuskw_text_input-help-toggle"==t&&(a.addClass("wpglobus-focuskw_text_input-help-toggle_"+s),p(document).on("click",".wpglobus-focuskw_text_input-help-toggle_"+s,function(e){var t=p(this);"none"===p("#focuskw_text_input-help_"+t.data("language")).css("display")?p("#focuskw_text_input-help_"+t.data("language")).css({display:"block"}):p("#focuskw_text_input-help_"+t.data("language")).css({display:"none"})})),"pageanalysis-help-toggle"==t&&(a.addClass("wpglobus-pageanalysis-help-toggle_"+s),p(document).on("click",".wpglobus-pageanalysis-help-toggle_"+s,function(e){var t=p(this);"none"===p("#pageanalysis-help_"+t.data("language")).css("display")?p("#pageanalysis-help_"+t.data("language")).css({display:"block"}):p("#pageanalysis-help_"+t.data("language")).css({display:"none"})})),a.attr("id",t+"_"+s),p("#"+t+"_"+s).attr("data-language",s)});var i=WPGlobusCore.TextFilter(p("#yoast_wpseo_focuskw_text_input").val(),s,"RETURN_EMPTY");p("#yoast_wpseo_focuskw_text_input_"+s).val(i),p("#yoast_wpseo_focuskw_"+s).val(i),r.updateWpseoKeyword(i,s),s!==WPGlobusCoreData.default_language&&(p("#"+o+" #yoast_wpseo_focuskw_text_input_"+s).addClass("hidden").after('<div class="wpglobus-suggest" style="font-weight:bold;">'+WPGlobusVendor.i18n.yoastseo_plus_access+"</div>"),p("#"+o+" #wpseo-pageanalysis_"+s).addClass("hidden").css({display:"none"}))}),p(".wpglobus-wpseosnippet").each(function(e,t){var a=p(t),s=a.data("language");a.find("button.snippet-editor__button.snippet-editor__edit-button").addClass(r.editSnippetButtonClass).addClass(r.editSnippetButtonClass+"_"+s).attr("data-language",s),a.find(".snippet-editor__form").addClass(r.editSnippetFormClass).addClass(r.editSnippetFormClass+"_"+s),a.find(".snippet-editor__heading-editor").addClass(r.editSnippetHeadingClass).addClass(r.editSnippetHeadingClass+"_"+s),a.find(".snippet-editor__submit").addClass(r.editSnippetSubmitClass).addClass(r.editSnippetSubmitClass+"_"+s).attr("data-language",s)}),r.iB.addClass("hidden"),r.iB.css({height:0,overflow:"hidden"});var e=WPGlobusCore.TextFilter(p("#yoast_wpseo_focuskw_text_input").val(),WPGlobusCoreData.default_language,"RETURN_EMPTY");p("#yoast_wpseo_focuskw_text_input").val(e),p("#yoast_wpseo_focuskw").val(e),p(".wpglobus-wpseo-general .wpseo_tablink").on("click",function(e){e.preventDefault();var t=p(this),a=t.parents("ul").data("language"),s=t.parent("li");a!=WPGlobusCoreData.default_language&&void 0===p(document).triggerHandler("wpglobus_yoast_analysis",{language:a})||(s.hasClass("wpseo_content_tab")?(p("#wpseo-pageanalysis_"+a).css({display:"none"}),p("#yoast-seo-content-analysis_"+a).css({display:"block"}),p("#wpseo_content_"+a+" table tr").eq(0).css({display:"none"}),p("#wpseo_content_"+a+" table tr").eq(1).css({display:"none"}),p("#yoast-seo-content-analysis_"+a+" li a").css({float:"none"})):s.hasClass("wpseo_keyword_tab")&&(p("#wpseo-pageanalysis_"+a).css({display:"block"}),p("#yoast-seo-content-analysis_"+a).css({display:"none"}),p("#wpseo_content_"+a+" table tr").eq(0).css("display",""),p("#wpseo_content_"+a+" table tr").eq(1).css("display","")))}),p(".wpseo-metabox-sidebar .wpseo-meta-section-link").on("click",function(e){"#wpseo-meta-section-content"==p(this).attr("href")?p("#wpglobus-wpseo-tabs").css({display:"block"}):p("#wpglobus-wpseo-tabs").css({display:"none"})}),p("body").on("click","."+r.editSnippetButtonClass,function(e){var t=p(this),a=t.data("language"),s=p("."+r.editSnippetFormClass+"_"+a),o=p("."+r.editSnippetSubmitClass+"_"+a),i=p("."+r.editSnippetHeadingClass+"_"+a);s.hasClass("snippet-editor--hidden")?(s.removeClass("snippet-editor--hidden"),i.removeClass("snippet-editor--hidden"),o.removeClass("snippet-editor--hidden")):(s.addClass("snippet-editor--hidden"),i.addClass("snippet-editor--hidden")),t.addClass("snippet-editor--hidden")}),p("body").on("click","."+r.editSnippetSubmitClass,function(e){var t=p(this).data("language"),a=p("."+r.editSnippetButtonClass+"_"+t),s=p("."+r.editSnippetFormClass+"_"+t),o=p("."+r.editSnippetSubmitClass+"_"+t),i=p("."+r.editSnippetHeadingClass+"_"+t);a.removeClass("snippet-editor--hidden"),s.addClass("snippet-editor--hidden"),o.addClass("snippet-editor--hidden"),i.addClass("snippet-editor--hidden")}),p(document).on("keyup","input.wpglobus-snippet-editor-title",function(e){var t=p(this),a=t.data("language"),s=WPGlobusCore.getString(p('input[name="yoast_wpseo_title"]').val(),t.val(),a);p("#snippet_title_"+a).html(d.replaceVariablesPlugin(t.val())),YoastSEO.app.rawData.pageTitle=s,p('input[name="yoast_wpseo_title"]').val(s),p("#snippet_title").text(s),_.debounce(r.updateProgressBar(t,a),500)}),p(document).on("keyup","input.wpglobus-snippet-editor-slug",function(e){var t=p(this),a=t.data("language");p("#snippet_cite_"+a).text(t.val()+"/"),p("#editable-post-name").text(t.val()),p("#editable-post-name-full").text(t.val())}),p(document).on("change","input.wpglobus-snippet-editor-slug",function(e){var t=p(this);p.post(ajaxurl,{action:"sample-permalink",post_id:p("#post_ID").val()||0,new_slug:t.val(),new_title:p("#title").val(),samplepermalinknonce:p("#samplepermalinknonce").val()})}),p(document).on("keyup","textarea.wpglobus-snippet-editor-meta-description",function(e){var t=p(this),a=t.data("language");p("#snippet_meta_"+a).text(t.val());var s=WPGlobusCore.getString(p("#yoast_wpseo_metadesc").val(),t.val(),t.data("language"));p("#yoast_wpseo_metadesc").val(s),p("#snippet_meta").text(s),_.debounce(r.updateProgressBar(t,a),500)}),p("body").on("click",".wpglobus-post-body-tabs-list li",function(e){var t=p(this);if(t.hasClass("wpglobus-post-tab")){p("#wpglobus-wpseo-tabs").tabs("option","active",t.data("order"));var a=p("#yoast_wpseo_focuskw_text_input_"+p(this).data("language")).val();YoastSEO.app.rawData.keyword=a,p("#yoast_wpseo_focuskw_text_input").val(a),p('input[name="yoast_wpseo_focuskw"]').val(a),s.prototype.analyze()}}),r.initAddKeywordPopup()}},(s=function(){this.replaceVars=wpseoReplaceVarsL10n.replace_vars,this.language=WPGlobusCoreData.default_language,this.tab=WPGlobusCoreData.default_language,this.wpseoTab=WPGlobusCoreData.default_language,this.title_template=wpseoPostScraperL10n.title_template,this.focuskw=p("#yoast_wpseo_focuskw_text_input"),this.focuskw_hidden=p('input[name="yoast_wpseo_focuskw"]'),this.focuskwKeep=!1,this.post_slug="#editable-post-name-full",YoastSEO.app.registerPlugin("wpglobusYoastSeoPlugin",{status:"ready"}),YoastSEO.app.registerModification("content",this.contentModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("title",this.titleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_title",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_meta",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_page_title",this.pageTitleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_meta_desc",this.metaDescModification,"wpglobusYoastSeoPlugin",0),s.prototype.setScoreIcon(),p(document).on("blur",".wpglobus-snippet_title",function(e){var t=p(this),a=WPGlobusCore.getString(p("#yoast_wpseo_title").val(),t.text(),t.data("language"));YoastSEO.app.rawData.pageTitle=a,p('input[name="yoast_wpseo_title"]').val(a),p("#snippet_title").text(a)}),p(document).on("blur",".wpglobus-snippet_meta",function(e){var t=p(this),a=WPGlobusCore.getString(p("#yoast_wpseo_metadesc").val(),t.text(),t.data("language"));p("#yoast_wpseo_metadesc").val(a),p("#snippet_meta").text(a)}),p(document).on("keyup",".wpglobus-yoast_wpseo_focuskw_text_input",function(e){var t=p(this),a=t.val();d.focuskw.val(a),d.focuskw_hidden.val(a),d.updateWpseoKeyword(a,t.data("language")),s.prototype.analyze()}),p("#publish,#save-post").on("mouseenter",function(e){var a,s="";p(".wpglobus-yoast_wpseo_focuskw_text_input").each(function(e,t){a=p(this),s=WPGlobusCore.getString(s,a.val(),a.data("language"))}),d.focuskw.val(s),d.focuskw_hidden.val(s)}).on("mouseleave",function(e){if(!d.focuskwKeep){d.wpseoTab=p(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");p(this);d.focuskw.val(p("#yoast_wpseo_focuskw_text_input_"+d.wpseoTab).val()),d.focuskw_hidden.val(p("#yoast_wpseo_focuskw_text_input_"+d.wpseoTab).val())}}).on("click",function(e){d.focuskwKeep=!0}),p(WPGlobusYoastSeo.wpseoTabSelector).on("tabsactivate",function(e,t){if(d.language=t.newPanel.attr("data-language"),t.newPanel.attr("data-language")===WPGlobusCoreData.default_language){var a=p("#yoast_wpseo_focuskw_text_input_"+WPGlobusCoreData.default_language).val();YoastSEO.app.rawData.keyword=a,d.focuskw.val(a),d.focuskw_hidden.val(a)}s.prototype.analyze()}),d=this}).prototype.analyze=function(){var e=p(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");e==WPGlobusCoreData.default_language?YoastSEO.app.snippetPreview.data.urlPath=p("#editable-post-name-full").text():0!=p("#editable-post-name-full-"+e).length?YoastSEO.app.snippetPreview.data.urlPath=p("#editable-post-name-full-"+e).text():YoastSEO.app.snippetPreview.data.urlPath=p("#editable-post-name-full").text(),YoastSEO.app.analyzeTimer(YoastSEO.app),s.prototype.setScoreIcon()},s.prototype.setScoreIcon=function(){var a;a=setInterval(function(){var e=p(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language"),t=p("#wpseo-metabox-tabs .wpseo-score-icon").attr("class");"bad"!=(t=t.replace("wpseo-score-icon ",""))&&"ok"!=t&&"good"!=t||(p("#wpseo-metabox-tabs_"+e+" .wpseo-score-icon").removeClass("bad ok good 100"),p("#wpseo-metabox-tabs_"+e+" .wpseo-score-icon").addClass(t),clearInterval(a))},700)},s.prototype.getWPseoTab=function(){return p(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language")},s.prototype.citeModification=function(e){var t="#snippet_citeBase_"+e,a="#snippet_cite_"+e,s=p("#wpseo-tab-"+e).data("yoast-cite-base");!1===p("#wpseo-tab-"+e).data("cite-contenteditable")&&p(a).attr("contenteditable","false"),p(t).text(s)},s.prototype.pageTitleModification=function(e){var a,s,o,i="#snippet_title_",n="",l="";if(d.title_template==e)p.each(WPGlobusCoreData.enabled_languages,function(e,t){s=p("#snippet-editor-title_"+t).val(),o=0==s.length?d.title_template:s,n=d.replaceVariablesPlugin(o),p(i+t).text(n),t==d.getWPseoTab()&&(l=n)});else{if(a=WPGlobusCore.getTranslations(e),d.getWPseoTab()!==WPGlobusCoreData.default_language&&a[WPGlobusCoreData.default_language]==e){var t=d.getWPseoTab();return s=p("#snippet-editor-title_"+t).val(),o=0<s.length?s:d.title_template,o=d.replaceVariablesPlugin(o),p(i+t).text(o),o}p.each(WPGlobusCoreData.enabled_languages,function(e,t){n=""===a[t]?d.replaceVariablesPlugin(d.title_template):d.replaceVariablesPlugin(a[t]),t==d.getWPseoTab()&&(l=n,0!=(s=p("#snippet-editor-title_"+t).val()).length?s!=l&&(l=d.replaceVariablesPlugin(s)):l=d.replaceVariablesPlugin(d.title_template)),p(i+t).html(l)})}return l},s.prototype.metaDescModification=function(a){var e,s="#snippet_meta_",t=WPGlobusCore.getTranslations(a),o="";if(e=p("#snippet-editor-meta-description_"+d.getWPseoTab()).val(),d.getWPseoTab()!==WPGlobusCoreData.default_language&&t[WPGlobusCoreData.default_language]==a){var i=d.getWPseoTab();return d.citeModification(i),0==e.length?p(s+i).text(""):e!=a&&p(s+i).text(e),a}return p.each(WPGlobusCoreData.enabled_languages,function(e,t){p(s+t).text(WPGlobusCore.TextFilter(a,t,"RETURN_EMPTY")),d.citeModification(t)}),e==t[d.getWPseoTab()]?0==(o=t[d.getWPseoTab()]).length&&p(s+d.getWPseoTab()).text(WPGlobusCore.TextFilter(YoastSEO.app.snippetPreview.data.metaDesc,WPGlobusCoreData.default_language,"RETURN_EMPTY")):0==(o=e).length?p(s+d.getWPseoTab()).text(WPGlobusCore.TextFilter(YoastSEO.app.snippetPreview.data.metaDesc,WPGlobusCoreData.default_language,"RETURN_EMPTY")):p(s+d.getWPseoTab()).text(o),p(s+d.getWPseoTab()).text(o),o},s.prototype.snippetModification=function(e){return WPGlobusCore.TextFilter(e,d.getWPseoTab(),"RETURN_EMPTY")},s.prototype.contentModification=function(e){return d.getWPseoTab()==WPGlobusCoreData.default_language?e:p("#content_"+d.getWPseoTab()).val()},s.prototype.titleModification=function(e){return setTimeout(d.updatePageAnalysis,1e3),d.getWPseoTab()==WPGlobusCoreData.default_language?e:p("#title_"+d.getWPseoTab()).val()},s.prototype.defaultReplace=function(e){var t=YoastSEO.app.rawData.keyword;return e.replace(/%%sitedesc%%/g,this.replaceVars.sitedesc).replace(/%%sitename%%/g,WPGlobusCore.TextFilter(this.replaceVars.sitename,d.getWPseoTab())).replace(/%%term_title%%/g,this.replaceVars.term_title).replace(/%%term_description%%/g,this.replaceVars.term_description).replace(/%%category_description%%/g,this.replaceVars.category_description).replace(/%%tag_description%%/g,this.replaceVars.tag_description).replace(/%%searchphrase%%/g,this.replaceVars.searchphrase).replace(/%%date%%/g,this.replaceVars.date).replace(/%%id%%/g,this.replaceVars.id).replace(/%%page%%/g,this.replaceVars.page).replace(/%%currenttime%%/g,this.replaceVars.currenttime).replace(/%%currentdate%%/g,this.replaceVars.currentdate).replace(/%%currentday%%/g,this.replaceVars.currentday).replace(/%%currentmonth%%/g,this.replaceVars.currentmonth).replace(/%%currentyear%%/g,this.replaceVars.currentyear).replace(/%%focuskw%%/g,t)},s.prototype.replaceVariablesPlugin=function(e){return void 0!==e&&(e=this.titleReplace(e),e=this.defaultReplace(e),e=this.replaceSeparators(e)),e},s.prototype.replaceSeparators=function(e){return e.replace(/%%sep%%(\s+%%sep%%)*/g,this.replaceVars.sep)},s.prototype.titleReplace=function(e){var t="";return void 0===(t=this.language==WPGlobusCoreData.default_language?p("#title").val():p("#title_"+this.language).val())&&(t=YoastSEO.app.rawData.pageTitle),this.language!=WPGlobusCoreData.default_language&&0==t.length&&(t=p("#title").val()),e=e.replace(/%%title%%/g,t)},s.prototype.doubleSepReplace=function(e){var t=YoastSEO.app.stringHelper.addEscapeChars(this.replaceVars.sep),a=new RegExp(t+" "+t,"g");return e=e.replace(a,this.replaceVars.sep)},s.prototype.updateWpseoKeyword=function(e,t){0<p("#wpseo-meta-section-content_"+t+" .wpseo-keyword").length&&p("#wpseo-meta-section-content_"+t+" .wpseo-keyword").eq(1).removeClass("wpseo-keyword").addClass("wpglobus-wpseo_keyword_"+t),p(".wpglobus-wpseo_keyword_"+t).text(e)},s.prototype.updatePageAnalysis=function(){p("#wpseo-pageanalysis_"+d.getWPseoTab()).html(p("#wpseo-pageanalysis").html()),p("#yoast-seo-content-analysis_"+d.getWPseoTab()).html(p("#yoast-seo-content-analysis").html()),p("#yoast-seo-content-analysis_"+d.getWPseoTab()+" li a").css({float:"none"})},window.WPGlobusYoastSeoPlugin=new s}});
includes/js/wpglobus-yoastseo-34.min.js CHANGED
@@ -1 +1 @@
1
- var WPGlobusYoastSeo;jQuery(document).ready(function(e){"use strict";if("undefined"!=typeof wpseoReplaceVarsL10n&&"undefined"!=typeof WPGlobusCoreData&&"undefined"!=typeof WPGlobusVendor){var t;if("edit-tags.php"==WPGlobusVendor.pagenow||"term.php"==WPGlobusVendor.pagenow){t=WPGlobusYoastSeo={editorIDs:["description"],editor:{},submitId:"#submit",preventChangeEditor:!1,observer:null,init:function(){t.attachListeners(),_.delay(t.start,1500)},submit:function(a){"mouseenter"===a.type?e.each(t.editor,function(a,s){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(t.editor[a].content):tinymce.get(a).setContent(t.editor[a].content)}):"mouseleave"===a.type?t.preventChangeEditor||(e.each(t.editor,function(a,s){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(WPGlobusCore.TextFilter(s.content,t.getCurrentTab(),"RETURN_EMPTY")):tinymce.get(a).setContent(WPGlobusCore.TextFilter(s.content,t.getCurrentTab(),"RETURN_EMPTY"))}),t.preventChangeEditor=!1):"click"===a.type&&(t.preventChangeEditor=!0,"tinymce"!=getUserSetting("editor")&&setUserSetting("editor","tinymce"))},attachListeners:function(){e(".wrap").on("tabsactivate",function(a,s){e.each(t.editor,function(a,o){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(WPGlobusCore.TextFilter(o.content,s.newTab[0].dataset.language,"RETURN_EMPTY")):tinymce.get(a).setContent(WPGlobusCore.TextFilter(o.content,s.newTab[0].dataset.language,"RETURN_EMPTY"))})}),e(document).on("mouseenter",t.submitId,t.submit).on("mouseleave",t.submitId,t.submit).on("click",t.submitId,t.submit),e(document).on("tinymce-editor-init",function(a,s){if(-1!=_.indexOf(t.editorIDs,s.id)){var o=e("#"+s.id);t.editor[s.id]={},t.editor[s.id].contentEditor=s,t.editor[s.id].content=o.val(),s.setContent(WPGlobusCore.TextFilter(t.editor[s.id].content,WPGlobusCoreData.default_language,"RETURN_EMPTY")),e("#"+s.getContainer().id).find("iframe").addClass("wpglobus-translatable"),o.removeClass("hidden"),s.on("nodechange keyup",_.debounce(t.update,500)),o.on("input keyup",_.debounce(t.update,500))}})},update:function(a){var s,o;void 0!==a.target&&("tinymce"==(s=a.target.id)&&(s=a.target.dataset.id),void 0!==t.editor[s].contentEditor&&(o=!t.editor[s].contentEditor||t.editor[s].contentEditor.isHidden()?e("#"+s).val():t.editor[s].contentEditor.getContent({format:"raw"}),t.editor[s].content=WPGlobusCore.getString(t.editor[s].content,o,t.getCurrentTab())))},getCurrentTab:function(){return e(".wpglobus-taxonomy-tabs-list .ui-tabs-active").data("language")},start:function(){e(".wpglobus-element_description").css({display:"none"})}},WPGlobusYoastSeo.init();var a=function(){e(".wrap").on("tabsactivate",function(t,a){a.newTab[0].dataset.language==WPGlobusCoreData.default_language?e("#poststuff .inside").css({display:"block"}):e("#poststuff .inside").css({display:"none"})}),e.each(["category_description","sitedesc","sitename","tag_description","term_description","term_title"],function(e,t){wpseoReplaceVarsL10n.replace_vars[t]=WPGlobusCore.TextFilter(wpseoReplaceVarsL10n.replace_vars[t],WPGlobusCoreData.default_language)}),WPGlobusYoastSeo.observer=new MutationObserver(function(t){t.forEach(function(t){if("placeholder"==t.attributeName){WPGlobusYoastSeo.observer.disconnect();var a=e("#wpseo_focuskw");""==a.val()&&a.attr("placeholder",WPGlobusCore.TextFilter(a.attr("placeholder"),WPGlobusCoreData.default_language)),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})}})}),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})};window.WPGlobusYoastSeoPlugin=new a}else{t=WPGlobusYoastSeo={wpseoTabSelector:"#wpglobus-wpseo-tabs",url:"",attrs:e("#wpglobus-wpseo-attr"),iB:e("#wpseo-meta-section-content"),t:e("#wpseo-meta-section-content"),ids:"",names:"",editSnippetButtonClass:"wpglobus-snippet-editor__edit-button",editSnippetFormClass:"wpglobus-snippet-editor__form",editSnippetSubmitClass:"wpglobus-snippet-editor__submit",editSnippetHeadingClass:"wpglobus-snippet-editor__heading-editor",yoastTitleProgress:"wpglobus-yoast-title-progress",yoastMetadescProgress:"wpglobus-yoast-metadesc-progress",init:function(){t.start()},initAddKeywordPopup:function(){1===e("#wpseo-add-keyword-popup").length&&e(".wpseo-add-keyword").on("click",t.addKeywordPopup)},addKeywordPopup:function(){var t=e("#wpseo-add-keyword-popup-button").text();tb_show(t,"#TB_inline?width=650&height=350&inlineId=wpseo-add-keyword-popup","group"),jQuery("#TB_window").css("height",235),jQuery("#TB_window").css("width",680)},qtip:function(){e(".yoast_help").qtip({content:{attr:"alt"},position:{my:"bottom left",at:"top center"},style:{tip:{corner:!0},classes:"yoast-qtip qtip-rounded qtip-blue"},show:"click",hide:{fixed:!0,delay:500}})},removeClasses:function(e,t){_.each(t,function(t){e.removeClass(t)})},updateProgressBar:function(a,s){if(void 0!==a&&(void 0!==s||("undefined"!==a.data("language")&&(s=a.data("language")),void 0!==s))){var o,i=["snippet-editor__progress--bad","snippet-editor__progress--ok","snippet-editor__progress--good"],n=0,l="",p=0,r=!1;n=a.val().length,a.hasClass("wpglobus-snippet-editor-title")?(p=(o=e("progress."+t.yoastTitleProgress+"_"+s)).attr("max"),l=i[2],0==n?l=i[1]:n>p?(l=i[1],r=!0):n>0&&n<35&&(l=i[1])):a.hasClass("wpglobus-snippet-editor-meta-description")&&(p=(o=e("progress."+t.yoastMetadescProgress+"_"+s)).attr("max"),l=i[2],0==n?l=i[1]:n>p?(l=i[1],r=!0):n>0&&n<121&&(l=i[1])),t.removeClasses(o,i),o.attr("value",n).addClass(l),r?a.css("color","#f00"):a.css("color","#000")}},updateWpseoKeyword:function(t,a){e("#wpseo-meta-section-content_"+a+" .wpseo-keyword").text(t)},start:function(){e(t.wpseoTabSelector).tabs(),t.ids=t.attrs.data("ids"),t.names=t.attrs.data("names"),t.ids=t.ids+","+t.attrs.data("qtip"),t.ids=t.ids.split(","),t.names=t.names.split(","),e("#wpglobus-wpseo-tabs").insertBefore(t.iB),e(".wpseo-metabox-tabs").css({height:"26px"}),e(".wpglobus-wpseo-general").each(function(a,s){var o=e(s),i=o.data("language"),n="wpseo-meta-section-content_"+i;o.html('<div id="'+n+'" class="wpseo-meta-section wpglobus-wpseo-meta-section" style="width:100%" data-language="'+i+'">'+t.t.html()+"</div>"),e("#"+n+" .wpseo-metabox-tabs").attr("id","wpseo-metabox-tabs_"+i).attr("data-language",i),e("#"+n+" .wpseotab").attr("id","wpseo_content_"+i),e("#wpseo_content_"+i).css({float:"left"}),e("#"+n).css({display:"block"}),e("#wpseo_meta").css({overflow:"hidden"}),e("#"+n+" .snippet_container").addClass("wpglobus-snippet_container"),i!==WPGlobusCoreData.default_language&&e("#"+n+" .wpseo-add-keyword").addClass("hidden"),e.each(t.names,function(t,a){e("#"+a).attr("name",a+"_"+i)}),e.each(t.ids,function(a,s){var o=e("#"+s);"wpseosnippet"==s&&o.addClass("wpglobus-wpseosnippet"),"snippet_title"==s&&o.addClass("wpglobus-snippet_title"),"snippet_meta"==s&&o.addClass("wpglobus-snippet_meta"),"snippet_cite"==s&&o.addClass("wpglobus-snippet_cite"),"snippet_citeBase"==s&&o.addClass("wpglobus-snippet_citeBase"),"url_container"==s&&o.css({height:"16px"}),"yoast_wpseo_focuskw_text_input"==s&&o.addClass("wpglobus-yoast_wpseo_focuskw_text_input"),"wpseo-pageanalysis"==s&&o.addClass("wpglobus-wpseo-pageanalysis"),"yoast-seo-content-analysis"==s&&o.addClass("wpglobus-yoast-seo-content-analysis"),"snippet_preview"==s&&o.addClass("wpglobus-snippet_preview"),"snippet-editor-title"==s&&(o.addClass("wpglobus-snippet-editor-title"),o.parent("label").attr("for",o.parent("label").attr("for")+"_"+i),o.val(e("#wpseo-tab-"+i).data("wpseotitle")),o.parent("label").next("progress").addClass(t.yoastTitleProgress).addClass(t.yoastTitleProgress+"_"+i),_.debounce(t.updateProgressBar(o,i),500)),"snippet-editor-slug"==s&&(o.addClass("wpglobus-snippet-editor-slug"),o.parent("label").attr("for",o.parent("label").attr("for")+"_"+i),WPGlobusCoreData.default_language!=i&&o.attr("disabled","disabled")),"snippet-editor-meta-description"==s&&(o.addClass("wpglobus-snippet-editor-meta-description"),o.parent("label").attr("for",o.parent("label").attr("for")+"_"+i),o.val(e("#wpseo-tab-"+i).data("metadesc")),o.parent("label").next("progress").addClass(t.yoastMetadescProgress).addClass(t.yoastMetadescProgress+"_"+i),_.debounce(t.updateProgressBar(o,i),500)),"snippetpreview-help-toggle"==s&&(o.addClass("wpglobus-snippetpreview-help-toggle_"+i),e(document).on("click",".wpglobus-snippetpreview-help-toggle_"+i,function(t){var a=e(this);"none"===e("#snippetpreview-help_"+a.data("language")).css("display")?e("#snippetpreview-help_"+a.data("language")).css({display:"block"}):e("#snippetpreview-help_"+a.data("language")).css({display:"none"})})),"focuskw_text_input-help-toggle"==s&&(o.addClass("wpglobus-focuskw_text_input-help-toggle_"+i),e(document).on("click",".wpglobus-focuskw_text_input-help-toggle_"+i,function(t){var a=e(this);"none"===e("#focuskw_text_input-help_"+a.data("language")).css("display")?e("#focuskw_text_input-help_"+a.data("language")).css({display:"block"}):e("#focuskw_text_input-help_"+a.data("language")).css({display:"none"})})),"pageanalysis-help-toggle"==s&&(o.addClass("wpglobus-pageanalysis-help-toggle_"+i),e(document).on("click",".wpglobus-pageanalysis-help-toggle_"+i,function(t){var a=e(this);"none"===e("#pageanalysis-help_"+a.data("language")).css("display")?e("#pageanalysis-help_"+a.data("language")).css({display:"block"}):e("#pageanalysis-help_"+a.data("language")).css({display:"none"})})),o.attr("id",s+"_"+i),e("#"+s+"_"+i).attr("data-language",i)});var l=WPGlobusCore.TextFilter(e("#yoast_wpseo_focuskw_text_input").val(),i,"RETURN_EMPTY");e("#yoast_wpseo_focuskw_text_input_"+i).val(l),e("#yoast_wpseo_focuskw_"+i).val(l),t.updateWpseoKeyword(l,i),i!==WPGlobusCoreData.default_language&&(e("#"+n+" #yoast_wpseo_focuskw_text_input_"+i).addClass("hidden").after('<div class="wpglobus-suggest" style="font-weight:bold;">'+WPGlobusVendor.i18n.yoastseo_plus_access+"</div>"),e("#"+n+" #wpseo-pageanalysis_"+i).addClass("hidden").css({display:"none"}))}),e(".wpglobus-wpseosnippet").each(function(a,s){var o=e(s),i=o.data("language");o.find("button.snippet-editor__button.snippet-editor__edit-button").addClass(t.editSnippetButtonClass).addClass(t.editSnippetButtonClass+"_"+i).attr("data-language",i),o.find(".snippet-editor__form").addClass(t.editSnippetFormClass).addClass(t.editSnippetFormClass+"_"+i),o.find(".snippet-editor__heading-editor").addClass(t.editSnippetHeadingClass).addClass(t.editSnippetHeadingClass+"_"+i),o.find(".snippet-editor__submit").addClass(t.editSnippetSubmitClass).addClass(t.editSnippetSubmitClass+"_"+i).attr("data-language",i)}),t.iB.addClass("hidden"),t.iB.css({height:0,overflow:"hidden",display:"none"});var o=WPGlobusCore.TextFilter(e("#yoast_wpseo_focuskw_text_input").val(),WPGlobusCoreData.default_language,"RETURN_EMPTY");e("#yoast_wpseo_focuskw_text_input").val(o),e("#yoast_wpseo_focuskw").val(o),e(".wpglobus-wpseo-general .wpseo_tablink").on("click",function(t){t.preventDefault();var a=e(this),s=a.parents("ul").data("language"),o=a.parent("li");s!=WPGlobusCoreData.default_language&&void 0===e(document).triggerHandler("wpglobus_yoast_analysis",{language:s})||(o.hasClass("wpseo_generic_tab")?(e("#wpseo-pageanalysis_"+s).css({display:"none"}),e("#yoast-seo-content-analysis_"+s).css({display:"block"}),e("#wpseo_content_"+s+" table tr").eq(0).css({display:"none"}),e("#wpseo_content_"+s+" table tr").eq(1).css({display:"none"}),e("#yoast-seo-content-analysis_"+s+" li a").css({float:"none"})):o.hasClass("wpseo_keyword_tab")&&(e("#wpseo-pageanalysis_"+s).css({display:"block"}),e("#yoast-seo-content-analysis_"+s).css({display:"none"}),e("#wpseo_content_"+s+" table tr").eq(0).css("display",""),e("#wpseo_content_"+s+" table tr").eq(1).css("display","")))}),e(".wpseo-metabox-sidebar .wpseo-meta-section-link").on("click",function(t){"#wpseo-meta-section-content"==e(this).attr("href")?e("#wpglobus-wpseo-tabs").css({display:"block"}):e("#wpglobus-wpseo-tabs").css({display:"none"})}),e("body").on("click","."+t.editSnippetButtonClass,function(a){var s=e(this),o=s.data("language"),i=e("."+t.editSnippetFormClass+"_"+o),n=e("."+t.editSnippetSubmitClass+"_"+o),l=e("."+t.editSnippetHeadingClass+"_"+o);i.hasClass("snippet-editor--hidden")?(i.removeClass("snippet-editor--hidden"),l.removeClass("snippet-editor--hidden"),n.removeClass("snippet-editor--hidden")):(i.addClass("snippet-editor--hidden"),l.addClass("snippet-editor--hidden")),s.addClass("snippet-editor--hidden")}),e("body").on("click","."+t.editSnippetSubmitClass,function(a){var s=e(this).data("language"),o=e("."+t.editSnippetButtonClass+"_"+s),i=e("."+t.editSnippetFormClass+"_"+s),n=e("."+t.editSnippetSubmitClass+"_"+s),l=e("."+t.editSnippetHeadingClass+"_"+s);o.removeClass("snippet-editor--hidden"),i.addClass("snippet-editor--hidden"),n.addClass("snippet-editor--hidden"),l.addClass("snippet-editor--hidden")}),e(document).on("keyup","input.wpglobus-snippet-editor-title",function(a){var o=e(this),i=o.data("language"),n=WPGlobusCore.getString(e('input[name="yoast_wpseo_title"]').val(),o.val(),i);e("#snippet_title_"+i).html(s.replaceVariablesPlugin(o.val())),YoastSEO.app.rawData.pageTitle=n,e('input[name="yoast_wpseo_title"]').val(n),e("#snippet_title").text(n),_.debounce(t.updateProgressBar(o,i),500)}),e(document).on("keyup","input.wpglobus-snippet-editor-slug",function(t){var a=e(this),s=a.data("language");e("#snippet_cite_"+s).text(a.val()+"/"),e("#editable-post-name").text(a.val()),e("#editable-post-name-full").text(a.val())}),e(document).on("change","input.wpglobus-snippet-editor-slug",function(t){var a=e(this);e.post(ajaxurl,{action:"sample-permalink",post_id:e("#post_ID").val()||0,new_slug:a.val(),new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()})}),e(document).on("keyup","textarea.wpglobus-snippet-editor-meta-description",function(a){var s=e(this),o=s.data("language");e("#snippet_meta_"+o).text(s.val());var i=WPGlobusCore.getString(e("#yoast_wpseo_metadesc").val(),s.val(),s.data("language"));e("#yoast_wpseo_metadesc").val(i),e("#snippet_meta").text(i),_.debounce(t.updateProgressBar(s,o),500)}),e("body").on("click",".wpglobus-post-body-tabs-list li",function(t){var s=e(this);if(s.hasClass("wpglobus-post-tab")){e("#wpglobus-wpseo-tabs").tabs("option","active",s.data("order"));var o=e("#yoast_wpseo_focuskw_text_input_"+e(this).data("language")).val();YoastSEO.app.rawData.keyword=o,e("#yoast_wpseo_focuskw_text_input").val(o),e('input[name="yoast_wpseo_focuskw"]').val(o),a.prototype.analyze()}}),t.initAddKeywordPopup()}};var s;(a=function(){this.replaceVars=wpseoReplaceVarsL10n.replace_vars,this.language=WPGlobusCoreData.default_language,this.tab=WPGlobusCoreData.default_language,this.wpseoTab=WPGlobusCoreData.default_language,this.title_template=wpseoPostScraperL10n.title_template,this.focuskw=e("#yoast_wpseo_focuskw_text_input"),this.focuskw_hidden=e('input[name="yoast_wpseo_focuskw"]'),this.focuskwKeep=!1,this.post_slug="#editable-post-name-full",YoastSEO.app.registerPlugin("wpglobusYoastSeoPlugin",{status:"ready"}),YoastSEO.app.registerModification("content",this.contentModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("title",this.titleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_title",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_meta",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_page_title",this.pageTitleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_meta_desc",this.metaDescModification,"wpglobusYoastSeoPlugin",0),a.prototype.setScoreIcon(),e(document).on("blur",".wpglobus-snippet_title",function(t){var a=e(this),s=WPGlobusCore.getString(e("#yoast_wpseo_title").val(),a.text(),a.data("language"));YoastSEO.app.rawData.pageTitle=s,e('input[name="yoast_wpseo_title"]').val(s),e("#snippet_title").text(s)}),e(document).on("blur",".wpglobus-snippet_meta",function(t){var a=e(this),s=WPGlobusCore.getString(e("#yoast_wpseo_metadesc").val(),a.text(),a.data("language"));e("#yoast_wpseo_metadesc").val(s),e("#snippet_meta").text(s)}),e(document).on("keyup",".wpglobus-yoast_wpseo_focuskw_text_input",function(t){var o=e(this),i=o.val();s.focuskw.val(i),s.focuskw_hidden.val(i),s.updateWpseoKeyword(i,o.data("language")),a.prototype.analyze()}),e("#publish,#save-post").on("mouseenter",function(t){var a,o="";e(".wpglobus-yoast_wpseo_focuskw_text_input").each(function(t,s){a=e(this),o=WPGlobusCore.getString(o,a.val(),a.data("language"))}),s.focuskw.val(o),s.focuskw_hidden.val(o)}).on("mouseleave",function(t){if(!s.focuskwKeep){s.wpseoTab=e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");e(this);s.focuskw.val(e("#yoast_wpseo_focuskw_text_input_"+s.wpseoTab).val()),s.focuskw_hidden.val(e("#yoast_wpseo_focuskw_text_input_"+s.wpseoTab).val())}}).on("click",function(e){s.focuskwKeep=!0}),e(WPGlobusYoastSeo.wpseoTabSelector).on("tabsactivate",function(t,o){if(s.language=o.newPanel.attr("data-language"),o.newPanel.attr("data-language")===WPGlobusCoreData.default_language){var i=e("#yoast_wpseo_focuskw_text_input_"+WPGlobusCoreData.default_language).val();YoastSEO.app.rawData.keyword=i,s.focuskw.val(i),s.focuskw_hidden.val(i)}a.prototype.analyze()}),s=this}).prototype.analyze=function(){var t=e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");t==WPGlobusCoreData.default_language?YoastSEO.app.snippetPreview.data.urlPath=e("#editable-post-name-full").text():0!=e("#editable-post-name-full-"+t).length?YoastSEO.app.snippetPreview.data.urlPath=e("#editable-post-name-full-"+t).text():YoastSEO.app.snippetPreview.data.urlPath=e("#editable-post-name-full").text(),YoastSEO.app.analyzeTimer(YoastSEO.app),a.prototype.setScoreIcon()},a.prototype.setScoreIcon=function(){var t;t=setInterval(function(){var a=e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language"),s=e("#wpseo-metabox-tabs .wpseo-score-icon").attr("class");"bad"!=(s=s.replace("wpseo-score-icon ",""))&&"ok"!=s&&"good"!=s||(e("#wpseo-metabox-tabs_"+a+" .wpseo-score-icon").removeClass("bad ok good 100"),e("#wpseo-metabox-tabs_"+a+" .wpseo-score-icon").addClass(s),clearInterval(t))},700)},a.prototype.getWPseoTab=function(){return e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language")},a.prototype.citeModification=function(t){var a="#snippet_citeBase_"+t,s="#snippet_cite_"+t,o=e("#wpseo-tab-"+t).data("yoast-cite-base");!1===e("#wpseo-tab-"+t).data("cite-contenteditable")&&e(s).attr("contenteditable","false"),e(a).text(o)},a.prototype.pageTitleModification=function(t){var a,o,i,n="#snippet_title_",l="",p="";if(s.title_template==t)e.each(WPGlobusCoreData.enabled_languages,function(t,a){o=e("#snippet-editor-title_"+a).val(),i=0==o.length?s.title_template:o,l=s.replaceVariablesPlugin(i),e(n+a).text(l),a==s.getWPseoTab()&&(p=l)});else{if(a=WPGlobusCore.getTranslations(t),s.getWPseoTab()!==WPGlobusCoreData.default_language&&a[WPGlobusCoreData.default_language]==t){var r=s.getWPseoTab();return o=e("#snippet-editor-title_"+r).val(),i=o.length>0?o:s.title_template,i=s.replaceVariablesPlugin(i),e(n+r).text(i),i}e.each(WPGlobusCoreData.enabled_languages,function(t,i){l=""===a[i]?s.replaceVariablesPlugin(s.title_template):s.replaceVariablesPlugin(a[i]),i==s.getWPseoTab()&&(p=l,0!=(o=e("#snippet-editor-title_"+i).val()).length?o!=p&&(p=s.replaceVariablesPlugin(o)):p=s.replaceVariablesPlugin(s.title_template)),e(n+i).html(p)})}return p},a.prototype.metaDescModification=function(t){var a="#snippet_meta_",o="",i=WPGlobusCore.getTranslations(t),n="";if(o=e("#snippet-editor-meta-description_"+s.getWPseoTab()).val(),s.getWPseoTab()!==WPGlobusCoreData.default_language&&i[WPGlobusCoreData.default_language]==t){var l=s.getWPseoTab();return s.citeModification(l),0==o.length?e(a+l).text(""):o!=t&&e(a+l).text(o),t}return e.each(WPGlobusCoreData.enabled_languages,function(o,i){e(a+i).text(WPGlobusCore.TextFilter(t,i,"RETURN_EMPTY")),s.citeModification(i)}),o==i[s.getWPseoTab()]?0==(n=i[s.getWPseoTab()]).length&&e(a+s.getWPseoTab()).text(WPGlobusCore.TextFilter(YoastSEO.app.snippetPreview.data.metaDesc,WPGlobusCoreData.default_language,"RETURN_EMPTY")):0==(n=o).length?e(a+s.getWPseoTab()).text(WPGlobusCore.TextFilter(YoastSEO.app.snippetPreview.data.metaDesc,WPGlobusCoreData.default_language,"RETURN_EMPTY")):e(a+s.getWPseoTab()).text(n),e(a+s.getWPseoTab()).text(n),n},a.prototype.snippetModification=function(e){return WPGlobusCore.TextFilter(e,s.getWPseoTab(),"RETURN_EMPTY")},a.prototype.contentModification=function(t){return s.getWPseoTab()==WPGlobusCoreData.default_language?t:e("#content_"+s.getWPseoTab()).val()},a.prototype.titleModification=function(t){return setTimeout(s.updatePageAnalysis,1e3),s.getWPseoTab()==WPGlobusCoreData.default_language?t:e("#title_"+s.getWPseoTab()).val()},a.prototype.defaultReplace=function(e){var t=YoastSEO.app.rawData.keyword;return e.replace(/%%sitedesc%%/g,this.replaceVars.sitedesc).replace(/%%sitename%%/g,WPGlobusCore.TextFilter(this.replaceVars.sitename,s.getWPseoTab())).replace(/%%term_title%%/g,this.replaceVars.term_title).replace(/%%term_description%%/g,this.replaceVars.term_description).replace(/%%category_description%%/g,this.replaceVars.category_description).replace(/%%tag_description%%/g,this.replaceVars.tag_description).replace(/%%searchphrase%%/g,this.replaceVars.searchphrase).replace(/%%date%%/g,this.replaceVars.date).replace(/%%id%%/g,this.replaceVars.id).replace(/%%page%%/g,this.replaceVars.page).replace(/%%currenttime%%/g,this.replaceVars.currenttime).replace(/%%currentdate%%/g,this.replaceVars.currentdate).replace(/%%currentday%%/g,this.replaceVars.currentday).replace(/%%currentmonth%%/g,this.replaceVars.currentmonth).replace(/%%currentyear%%/g,this.replaceVars.currentyear).replace(/%%focuskw%%/g,t)},a.prototype.replaceVariablesPlugin=function(e){return void 0!==e&&(e=this.titleReplace(e),e=this.defaultReplace(e),e=this.replaceSeparators(e)),e},a.prototype.replaceSeparators=function(e){return e.replace(/%%sep%%(\s+%%sep%%)*/g,this.replaceVars.sep)},a.prototype.titleReplace=function(t){var a="";return void 0===(a=this.language==WPGlobusCoreData.default_language?e("#title").val():e("#title_"+this.language).val())&&(a=YoastSEO.app.rawData.pageTitle),this.language!=WPGlobusCoreData.default_language&&0==a.length&&(a=e("#title").val()),t=t.replace(/%%title%%/g,a)},a.prototype.doubleSepReplace=function(e){var t=YoastSEO.app.stringHelper.addEscapeChars(this.replaceVars.sep),a=new RegExp(t+" "+t,"g");return e=e.replace(a,this.replaceVars.sep)},a.prototype.updateWpseoKeyword=function(t,a){e("#wpseo-meta-section-content_"+a+" .wpseo-keyword").length>0&&e("#wpseo-meta-section-content_"+a+" .wpseo-keyword").removeClass("wpseo-keyword").addClass("wpglobus-wpseo_keyword_"+a),e(".wpglobus-wpseo_keyword_"+a).text(t)},a.prototype.updatePageAnalysis=function(){e("#wpseo-pageanalysis_"+s.getWPseoTab()).html(e("#wpseo-pageanalysis").html()),e("#yoast-seo-content-analysis_"+s.getWPseoTab()).html(e("#yoast-seo-content-analysis").html()),e("#yoast-seo-content-analysis_"+s.getWPseoTab()+" li a").css({float:"none"})},window.WPGlobusYoastSeoPlugin=new a}}});
1
+ var WPGlobusYoastSeo;jQuery(document).ready(function(p){"use strict";var r;if("undefined"!=typeof wpseoReplaceVarsL10n&&("undefined"!=typeof WPGlobusCoreData&&"undefined"!=typeof WPGlobusVendor))if("edit-tags.php"==WPGlobusVendor.pagenow||"term.php"==WPGlobusVendor.pagenow){r=WPGlobusYoastSeo={editorIDs:["description"],editor:{},submitId:"#submit",preventChangeEditor:!1,observer:null,init:function(){r.attachListeners(),_.delay(r.start,1500)},submit:function(e){"mouseenter"===e.type?p.each(r.editor,function(e,t){!r.editor[e].contentEditor||r.editor[e].contentEditor.isHidden()?p("#"+e).val(r.editor[e].content):tinymce.get(e).setContent(r.editor[e].content)}):"mouseleave"===e.type?r.preventChangeEditor||(p.each(r.editor,function(e,t){!r.editor[e].contentEditor||r.editor[e].contentEditor.isHidden()?p("#"+e).val(WPGlobusCore.TextFilter(t.content,r.getCurrentTab(),"RETURN_EMPTY")):tinymce.get(e).setContent(WPGlobusCore.TextFilter(t.content,r.getCurrentTab(),"RETURN_EMPTY"))}),r.preventChangeEditor=!1):"click"===e.type&&(r.preventChangeEditor=!0,"tinymce"!=getUserSetting("editor")&&setUserSetting("editor","tinymce"))},attachListeners:function(){p(".wrap").on("tabsactivate",function(e,a){p.each(r.editor,function(e,t){!r.editor[e].contentEditor||r.editor[e].contentEditor.isHidden()?p("#"+e).val(WPGlobusCore.TextFilter(t.content,a.newTab[0].dataset.language,"RETURN_EMPTY")):tinymce.get(e).setContent(WPGlobusCore.TextFilter(t.content,a.newTab[0].dataset.language,"RETURN_EMPTY"))})}),p(document).on("mouseenter",r.submitId,r.submit).on("mouseleave",r.submitId,r.submit).on("click",r.submitId,r.submit),p(document).on("tinymce-editor-init",function(e,t){if(-1!=_.indexOf(r.editorIDs,t.id)){var a=p("#"+t.id);r.editor[t.id]={},r.editor[t.id].contentEditor=t,r.editor[t.id].content=a.val(),t.setContent(WPGlobusCore.TextFilter(r.editor[t.id].content,WPGlobusCoreData.default_language,"RETURN_EMPTY")),p("#"+t.getContainer().id).find("iframe").addClass("wpglobus-translatable"),a.removeClass("hidden"),t.on("nodechange keyup",_.debounce(r.update,500)),a.on("input keyup",_.debounce(r.update,500))}})},update:function(e){var t,a;void 0!==e.target&&("tinymce"==(t=e.target.id)&&(t=e.target.dataset.id),void 0!==r.editor[t].contentEditor&&(a=!r.editor[t].contentEditor||r.editor[t].contentEditor.isHidden()?p("#"+t).val():r.editor[t].contentEditor.getContent({format:"raw"}),r.editor[t].content=WPGlobusCore.getString(r.editor[t].content,a,r.getCurrentTab())))},getCurrentTab:function(){return p(".wpglobus-taxonomy-tabs-list .ui-tabs-active").data("language")},start:function(){p(".wpglobus-element_description").css({display:"none"})}},WPGlobusYoastSeo.init();var s=function(){p(".wrap").on("tabsactivate",function(e,t){t.newTab[0].dataset.language==WPGlobusCoreData.default_language?p("#poststuff .inside").css({display:"block"}):p("#poststuff .inside").css({display:"none"})}),p.each(["category_description","sitedesc","sitename","tag_description","term_description","term_title"],function(e,t){wpseoReplaceVarsL10n.replace_vars[t]=WPGlobusCore.TextFilter(wpseoReplaceVarsL10n.replace_vars[t],WPGlobusCoreData.default_language)}),WPGlobusYoastSeo.observer=new MutationObserver(function(e){e.forEach(function(e){if("placeholder"==e.attributeName){WPGlobusYoastSeo.observer.disconnect();var t=p("#wpseo_focuskw");""==t.val()&&t.attr("placeholder",WPGlobusCore.TextFilter(t.attr("placeholder"),WPGlobusCoreData.default_language)),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})}})}),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})};window.WPGlobusYoastSeoPlugin=new s}else{var d;r=WPGlobusYoastSeo={wpseoTabSelector:"#wpglobus-wpseo-tabs",url:"",attrs:p("#wpglobus-wpseo-attr"),iB:p("#wpseo-meta-section-content"),t:p("#wpseo-meta-section-content"),ids:"",names:"",editSnippetButtonClass:"wpglobus-snippet-editor__edit-button",editSnippetFormClass:"wpglobus-snippet-editor__form",editSnippetSubmitClass:"wpglobus-snippet-editor__submit",editSnippetHeadingClass:"wpglobus-snippet-editor__heading-editor",yoastTitleProgress:"wpglobus-yoast-title-progress",yoastMetadescProgress:"wpglobus-yoast-metadesc-progress",init:function(){r.start()},initAddKeywordPopup:function(){1===p("#wpseo-add-keyword-popup").length&&p(".wpseo-add-keyword").on("click",r.addKeywordPopup)},addKeywordPopup:function(){var e=p("#wpseo-add-keyword-popup-button").text();tb_show(e,"#TB_inline?width=650&height=350&inlineId=wpseo-add-keyword-popup","group"),jQuery("#TB_window").css("height",235),jQuery("#TB_window").css("width",680)},qtip:function(){p(".yoast_help").qtip({content:{attr:"alt"},position:{my:"bottom left",at:"top center"},style:{tip:{corner:!0},classes:"yoast-qtip qtip-rounded qtip-blue"},show:"click",hide:{fixed:!0,delay:500}})},removeClasses:function(t,e){_.each(e,function(e){t.removeClass(e)})},updateProgressBar:function(e,t){if(void 0!==e&&(void 0!==t||("undefined"!==e.data("language")&&(t=e.data("language")),void 0!==t))){var a,s,o=["snippet-editor__progress--bad","snippet-editor__progress--ok","snippet-editor__progress--good"],i="",n=0,l=!1;s=e.val().length,e.hasClass("wpglobus-snippet-editor-title")?(n=(a=p("progress."+r.yoastTitleProgress+"_"+t)).attr("max"),i=o[2],0==s?i=o[1]:n<s?(i=o[1],l=!0):0<s&&s<35&&(i=o[1])):e.hasClass("wpglobus-snippet-editor-meta-description")&&(n=(a=p("progress."+r.yoastMetadescProgress+"_"+t)).attr("max"),i=o[2],0==s?i=o[1]:n<s?(i=o[1],l=!0):0<s&&s<121&&(i=o[1])),r.removeClasses(a,o),a.attr("value",s).addClass(i),l?e.css("color","#f00"):e.css("color","#000")}},updateWpseoKeyword:function(e,t){p("#wpseo-meta-section-content_"+t+" .wpseo-keyword").text(e)},start:function(){p(r.wpseoTabSelector).tabs(),r.ids=r.attrs.data("ids"),r.names=r.attrs.data("names"),r.ids=r.ids+","+r.attrs.data("qtip"),r.ids=r.ids.split(","),r.names=r.names.split(","),p("#wpglobus-wpseo-tabs").insertBefore(r.iB),p(".wpseo-metabox-tabs").css({height:"26px"}),p(".wpglobus-wpseo-general").each(function(e,t){var a=p(t),s=a.data("language"),o="wpseo-meta-section-content_"+s;a.html('<div id="'+o+'" class="wpseo-meta-section wpglobus-wpseo-meta-section" style="width:100%" data-language="'+s+'">'+r.t.html()+"</div>"),p("#"+o+" .wpseo-metabox-tabs").attr("id","wpseo-metabox-tabs_"+s).attr("data-language",s),p("#"+o+" .wpseotab").attr("id","wpseo_content_"+s),p("#wpseo_content_"+s).css({float:"left"}),p("#"+o).css({display:"block"}),p("#wpseo_meta").css({overflow:"hidden"}),p("#"+o+" .snippet_container").addClass("wpglobus-snippet_container"),s!==WPGlobusCoreData.default_language&&p("#"+o+" .wpseo-add-keyword").addClass("hidden"),p.each(r.names,function(e,t){p("#"+t).attr("name",t+"_"+s)}),p.each(r.ids,function(e,t){var a=p("#"+t);"wpseosnippet"==t&&a.addClass("wpglobus-wpseosnippet"),"snippet_title"==t&&a.addClass("wpglobus-snippet_title"),"snippet_meta"==t&&a.addClass("wpglobus-snippet_meta"),"snippet_cite"==t&&a.addClass("wpglobus-snippet_cite"),"snippet_citeBase"==t&&a.addClass("wpglobus-snippet_citeBase"),"url_container"==t&&a.css({height:"16px"}),"yoast_wpseo_focuskw_text_input"==t&&a.addClass("wpglobus-yoast_wpseo_focuskw_text_input"),"wpseo-pageanalysis"==t&&a.addClass("wpglobus-wpseo-pageanalysis"),"yoast-seo-content-analysis"==t&&a.addClass("wpglobus-yoast-seo-content-analysis"),"snippet_preview"==t&&a.addClass("wpglobus-snippet_preview"),"snippet-editor-title"==t&&(a.addClass("wpglobus-snippet-editor-title"),a.parent("label").attr("for",a.parent("label").attr("for")+"_"+s),a.val(p("#wpseo-tab-"+s).data("wpseotitle")),a.parent("label").next("progress").addClass(r.yoastTitleProgress).addClass(r.yoastTitleProgress+"_"+s),_.debounce(r.updateProgressBar(a,s),500)),"snippet-editor-slug"==t&&(a.addClass("wpglobus-snippet-editor-slug"),a.parent("label").attr("for",a.parent("label").attr("for")+"_"+s),WPGlobusCoreData.default_language!=s&&a.attr("disabled","disabled")),"snippet-editor-meta-description"==t&&(a.addClass("wpglobus-snippet-editor-meta-description"),a.parent("label").attr("for",a.parent("label").attr("for")+"_"+s),a.val(p("#wpseo-tab-"+s).data("metadesc")),a.parent("label").next("progress").addClass(r.yoastMetadescProgress).addClass(r.yoastMetadescProgress+"_"+s),_.debounce(r.updateProgressBar(a,s),500)),"snippetpreview-help-toggle"==t&&(a.addClass("wpglobus-snippetpreview-help-toggle_"+s),p(document).on("click",".wpglobus-snippetpreview-help-toggle_"+s,function(e){var t=p(this);"none"===p("#snippetpreview-help_"+t.data("language")).css("display")?p("#snippetpreview-help_"+t.data("language")).css({display:"block"}):p("#snippetpreview-help_"+t.data("language")).css({display:"none"})})),"focuskw_text_input-help-toggle"==t&&(a.addClass("wpglobus-focuskw_text_input-help-toggle_"+s),p(document).on("click",".wpglobus-focuskw_text_input-help-toggle_"+s,function(e){var t=p(this);"none"===p("#focuskw_text_input-help_"+t.data("language")).css("display")?p("#focuskw_text_input-help_"+t.data("language")).css({display:"block"}):p("#focuskw_text_input-help_"+t.data("language")).css({display:"none"})})),"pageanalysis-help-toggle"==t&&(a.addClass("wpglobus-pageanalysis-help-toggle_"+s),p(document).on("click",".wpglobus-pageanalysis-help-toggle_"+s,function(e){var t=p(this);"none"===p("#pageanalysis-help_"+t.data("language")).css("display")?p("#pageanalysis-help_"+t.data("language")).css({display:"block"}):p("#pageanalysis-help_"+t.data("language")).css({display:"none"})})),a.attr("id",t+"_"+s),p("#"+t+"_"+s).attr("data-language",s)});var i=WPGlobusCore.TextFilter(p("#yoast_wpseo_focuskw_text_input").val(),s,"RETURN_EMPTY");p("#yoast_wpseo_focuskw_text_input_"+s).val(i),p("#yoast_wpseo_focuskw_"+s).val(i),r.updateWpseoKeyword(i,s),s!==WPGlobusCoreData.default_language&&(p("#"+o+" #yoast_wpseo_focuskw_text_input_"+s).addClass("hidden").after('<div class="wpglobus-suggest" style="font-weight:bold;">'+WPGlobusVendor.i18n.yoastseo_plus_access+"</div>"),p("#"+o+" #wpseo-pageanalysis_"+s).addClass("hidden").css({display:"none"}))}),p(".wpglobus-wpseosnippet").each(function(e,t){var a=p(t),s=a.data("language");a.find("button.snippet-editor__button.snippet-editor__edit-button").addClass(r.editSnippetButtonClass).addClass(r.editSnippetButtonClass+"_"+s).attr("data-language",s),a.find(".snippet-editor__form").addClass(r.editSnippetFormClass).addClass(r.editSnippetFormClass+"_"+s),a.find(".snippet-editor__heading-editor").addClass(r.editSnippetHeadingClass).addClass(r.editSnippetHeadingClass+"_"+s),a.find(".snippet-editor__submit").addClass(r.editSnippetSubmitClass).addClass(r.editSnippetSubmitClass+"_"+s).attr("data-language",s)}),r.iB.addClass("hidden"),r.iB.css({height:0,overflow:"hidden",display:"none"});var e=WPGlobusCore.TextFilter(p("#yoast_wpseo_focuskw_text_input").val(),WPGlobusCoreData.default_language,"RETURN_EMPTY");p("#yoast_wpseo_focuskw_text_input").val(e),p("#yoast_wpseo_focuskw").val(e),p(".wpglobus-wpseo-general .wpseo_tablink").on("click",function(e){e.preventDefault();var t=p(this),a=t.parents("ul").data("language"),s=t.parent("li");a!=WPGlobusCoreData.default_language&&void 0===p(document).triggerHandler("wpglobus_yoast_analysis",{language:a})||(s.hasClass("wpseo_generic_tab")?(p("#wpseo-pageanalysis_"+a).css({display:"none"}),p("#yoast-seo-content-analysis_"+a).css({display:"block"}),p("#wpseo_content_"+a+" table tr").eq(0).css({display:"none"}),p("#wpseo_content_"+a+" table tr").eq(1).css({display:"none"}),p("#yoast-seo-content-analysis_"+a+" li a").css({float:"none"})):s.hasClass("wpseo_keyword_tab")&&(p("#wpseo-pageanalysis_"+a).css({display:"block"}),p("#yoast-seo-content-analysis_"+a).css({display:"none"}),p("#wpseo_content_"+a+" table tr").eq(0).css("display",""),p("#wpseo_content_"+a+" table tr").eq(1).css("display","")))}),p(".wpseo-metabox-sidebar .wpseo-meta-section-link").on("click",function(e){"#wpseo-meta-section-content"==p(this).attr("href")?p("#wpglobus-wpseo-tabs").css({display:"block"}):p("#wpglobus-wpseo-tabs").css({display:"none"})}),p("body").on("click","."+r.editSnippetButtonClass,function(e){var t=p(this),a=t.data("language"),s=p("."+r.editSnippetFormClass+"_"+a),o=p("."+r.editSnippetSubmitClass+"_"+a),i=p("."+r.editSnippetHeadingClass+"_"+a);s.hasClass("snippet-editor--hidden")?(s.removeClass("snippet-editor--hidden"),i.removeClass("snippet-editor--hidden"),o.removeClass("snippet-editor--hidden")):(s.addClass("snippet-editor--hidden"),i.addClass("snippet-editor--hidden")),t.addClass("snippet-editor--hidden")}),p("body").on("click","."+r.editSnippetSubmitClass,function(e){var t=p(this).data("language"),a=p("."+r.editSnippetButtonClass+"_"+t),s=p("."+r.editSnippetFormClass+"_"+t),o=p("."+r.editSnippetSubmitClass+"_"+t),i=p("."+r.editSnippetHeadingClass+"_"+t);a.removeClass("snippet-editor--hidden"),s.addClass("snippet-editor--hidden"),o.addClass("snippet-editor--hidden"),i.addClass("snippet-editor--hidden")}),p(document).on("keyup","input.wpglobus-snippet-editor-title",function(e){var t=p(this),a=t.data("language"),s=WPGlobusCore.getString(p('input[name="yoast_wpseo_title"]').val(),t.val(),a);p("#snippet_title_"+a).html(d.replaceVariablesPlugin(t.val())),YoastSEO.app.rawData.pageTitle=s,p('input[name="yoast_wpseo_title"]').val(s),p("#snippet_title").text(s),_.debounce(r.updateProgressBar(t,a),500)}),p(document).on("keyup","input.wpglobus-snippet-editor-slug",function(e){var t=p(this),a=t.data("language");p("#snippet_cite_"+a).text(t.val()+"/"),p("#editable-post-name").text(t.val()),p("#editable-post-name-full").text(t.val())}),p(document).on("change","input.wpglobus-snippet-editor-slug",function(e){var t=p(this);p.post(ajaxurl,{action:"sample-permalink",post_id:p("#post_ID").val()||0,new_slug:t.val(),new_title:p("#title").val(),samplepermalinknonce:p("#samplepermalinknonce").val()})}),p(document).on("keyup","textarea.wpglobus-snippet-editor-meta-description",function(e){var t=p(this),a=t.data("language");p("#snippet_meta_"+a).text(t.val());var s=WPGlobusCore.getString(p("#yoast_wpseo_metadesc").val(),t.val(),t.data("language"));p("#yoast_wpseo_metadesc").val(s),p("#snippet_meta").text(s),_.debounce(r.updateProgressBar(t,a),500)}),p("body").on("click",".wpglobus-post-body-tabs-list li",function(e){var t=p(this);if(t.hasClass("wpglobus-post-tab")){p("#wpglobus-wpseo-tabs").tabs("option","active",t.data("order"));var a=p("#yoast_wpseo_focuskw_text_input_"+p(this).data("language")).val();YoastSEO.app.rawData.keyword=a,p("#yoast_wpseo_focuskw_text_input").val(a),p('input[name="yoast_wpseo_focuskw"]').val(a),s.prototype.analyze()}}),r.initAddKeywordPopup()}},(s=function(){this.replaceVars=wpseoReplaceVarsL10n.replace_vars,this.language=WPGlobusCoreData.default_language,this.tab=WPGlobusCoreData.default_language,this.wpseoTab=WPGlobusCoreData.default_language,this.title_template=wpseoPostScraperL10n.title_template,this.focuskw=p("#yoast_wpseo_focuskw_text_input"),this.focuskw_hidden=p('input[name="yoast_wpseo_focuskw"]'),this.focuskwKeep=!1,this.post_slug="#editable-post-name-full",YoastSEO.app.registerPlugin("wpglobusYoastSeoPlugin",{status:"ready"}),YoastSEO.app.registerModification("content",this.contentModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("title",this.titleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_title",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_meta",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_page_title",this.pageTitleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_meta_desc",this.metaDescModification,"wpglobusYoastSeoPlugin",0),s.prototype.setScoreIcon(),p(document).on("blur",".wpglobus-snippet_title",function(e){var t=p(this),a=WPGlobusCore.getString(p("#yoast_wpseo_title").val(),t.text(),t.data("language"));YoastSEO.app.rawData.pageTitle=a,p('input[name="yoast_wpseo_title"]').val(a),p("#snippet_title").text(a)}),p(document).on("blur",".wpglobus-snippet_meta",function(e){var t=p(this),a=WPGlobusCore.getString(p("#yoast_wpseo_metadesc").val(),t.text(),t.data("language"));p("#yoast_wpseo_metadesc").val(a),p("#snippet_meta").text(a)}),p(document).on("keyup",".wpglobus-yoast_wpseo_focuskw_text_input",function(e){var t=p(this),a=t.val();d.focuskw.val(a),d.focuskw_hidden.val(a),d.updateWpseoKeyword(a,t.data("language")),s.prototype.analyze()}),p("#publish,#save-post").on("mouseenter",function(e){var a,s="";p(".wpglobus-yoast_wpseo_focuskw_text_input").each(function(e,t){a=p(this),s=WPGlobusCore.getString(s,a.val(),a.data("language"))}),d.focuskw.val(s),d.focuskw_hidden.val(s)}).on("mouseleave",function(e){if(!d.focuskwKeep){d.wpseoTab=p(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");p(this);d.focuskw.val(p("#yoast_wpseo_focuskw_text_input_"+d.wpseoTab).val()),d.focuskw_hidden.val(p("#yoast_wpseo_focuskw_text_input_"+d.wpseoTab).val())}}).on("click",function(e){d.focuskwKeep=!0}),p(WPGlobusYoastSeo.wpseoTabSelector).on("tabsactivate",function(e,t){if(d.language=t.newPanel.attr("data-language"),t.newPanel.attr("data-language")===WPGlobusCoreData.default_language){var a=p("#yoast_wpseo_focuskw_text_input_"+WPGlobusCoreData.default_language).val();YoastSEO.app.rawData.keyword=a,d.focuskw.val(a),d.focuskw_hidden.val(a)}s.prototype.analyze()}),d=this}).prototype.analyze=function(){var e=p(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");e==WPGlobusCoreData.default_language?YoastSEO.app.snippetPreview.data.urlPath=p("#editable-post-name-full").text():0!=p("#editable-post-name-full-"+e).length?YoastSEO.app.snippetPreview.data.urlPath=p("#editable-post-name-full-"+e).text():YoastSEO.app.snippetPreview.data.urlPath=p("#editable-post-name-full").text(),YoastSEO.app.analyzeTimer(YoastSEO.app),s.prototype.setScoreIcon()},s.prototype.setScoreIcon=function(){var a;a=setInterval(function(){var e=p(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language"),t=p("#wpseo-metabox-tabs .wpseo-score-icon").attr("class");"bad"!=(t=t.replace("wpseo-score-icon ",""))&&"ok"!=t&&"good"!=t||(p("#wpseo-metabox-tabs_"+e+" .wpseo-score-icon").removeClass("bad ok good 100"),p("#wpseo-metabox-tabs_"+e+" .wpseo-score-icon").addClass(t),clearInterval(a))},700)},s.prototype.getWPseoTab=function(){return p(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language")},s.prototype.citeModification=function(e){var t="#snippet_citeBase_"+e,a="#snippet_cite_"+e,s=p("#wpseo-tab-"+e).data("yoast-cite-base");!1===p("#wpseo-tab-"+e).data("cite-contenteditable")&&p(a).attr("contenteditable","false"),p(t).text(s)},s.prototype.pageTitleModification=function(e){var a,s,o,i="#snippet_title_",n="",l="";if(d.title_template==e)p.each(WPGlobusCoreData.enabled_languages,function(e,t){s=p("#snippet-editor-title_"+t).val(),o=0==s.length?d.title_template:s,n=d.replaceVariablesPlugin(o),p(i+t).text(n),t==d.getWPseoTab()&&(l=n)});else{if(a=WPGlobusCore.getTranslations(e),d.getWPseoTab()!==WPGlobusCoreData.default_language&&a[WPGlobusCoreData.default_language]==e){var t=d.getWPseoTab();return s=p("#snippet-editor-title_"+t).val(),o=0<s.length?s:d.title_template,o=d.replaceVariablesPlugin(o),p(i+t).text(o),o}p.each(WPGlobusCoreData.enabled_languages,function(e,t){n=""===a[t]?d.replaceVariablesPlugin(d.title_template):d.replaceVariablesPlugin(a[t]),t==d.getWPseoTab()&&(l=n,0!=(s=p("#snippet-editor-title_"+t).val()).length?s!=l&&(l=d.replaceVariablesPlugin(s)):l=d.replaceVariablesPlugin(d.title_template)),p(i+t).html(l)})}return l},s.prototype.metaDescModification=function(a){var e,s="#snippet_meta_",t=WPGlobusCore.getTranslations(a),o="";if(e=p("#snippet-editor-meta-description_"+d.getWPseoTab()).val(),d.getWPseoTab()!==WPGlobusCoreData.default_language&&t[WPGlobusCoreData.default_language]==a){var i=d.getWPseoTab();return d.citeModification(i),0==e.length?p(s+i).text(""):e!=a&&p(s+i).text(e),a}return p.each(WPGlobusCoreData.enabled_languages,function(e,t){p(s+t).text(WPGlobusCore.TextFilter(a,t,"RETURN_EMPTY")),d.citeModification(t)}),e==t[d.getWPseoTab()]?0==(o=t[d.getWPseoTab()]).length&&p(s+d.getWPseoTab()).text(WPGlobusCore.TextFilter(YoastSEO.app.snippetPreview.data.metaDesc,WPGlobusCoreData.default_language,"RETURN_EMPTY")):0==(o=e).length?p(s+d.getWPseoTab()).text(WPGlobusCore.TextFilter(YoastSEO.app.snippetPreview.data.metaDesc,WPGlobusCoreData.default_language,"RETURN_EMPTY")):p(s+d.getWPseoTab()).text(o),p(s+d.getWPseoTab()).text(o),o},s.prototype.snippetModification=function(e){return WPGlobusCore.TextFilter(e,d.getWPseoTab(),"RETURN_EMPTY")},s.prototype.contentModification=function(e){return d.getWPseoTab()==WPGlobusCoreData.default_language?e:p("#content_"+d.getWPseoTab()).val()},s.prototype.titleModification=function(e){return setTimeout(d.updatePageAnalysis,1e3),d.getWPseoTab()==WPGlobusCoreData.default_language?e:p("#title_"+d.getWPseoTab()).val()},s.prototype.defaultReplace=function(e){var t=YoastSEO.app.rawData.keyword;return e.replace(/%%sitedesc%%/g,this.replaceVars.sitedesc).replace(/%%sitename%%/g,WPGlobusCore.TextFilter(this.replaceVars.sitename,d.getWPseoTab())).replace(/%%term_title%%/g,this.replaceVars.term_title).replace(/%%term_description%%/g,this.replaceVars.term_description).replace(/%%category_description%%/g,this.replaceVars.category_description).replace(/%%tag_description%%/g,this.replaceVars.tag_description).replace(/%%searchphrase%%/g,this.replaceVars.searchphrase).replace(/%%date%%/g,this.replaceVars.date).replace(/%%id%%/g,this.replaceVars.id).replace(/%%page%%/g,this.replaceVars.page).replace(/%%currenttime%%/g,this.replaceVars.currenttime).replace(/%%currentdate%%/g,this.replaceVars.currentdate).replace(/%%currentday%%/g,this.replaceVars.currentday).replace(/%%currentmonth%%/g,this.replaceVars.currentmonth).replace(/%%currentyear%%/g,this.replaceVars.currentyear).replace(/%%focuskw%%/g,t)},s.prototype.replaceVariablesPlugin=function(e){return void 0!==e&&(e=this.titleReplace(e),e=this.defaultReplace(e),e=this.replaceSeparators(e)),e},s.prototype.replaceSeparators=function(e){return e.replace(/%%sep%%(\s+%%sep%%)*/g,this.replaceVars.sep)},s.prototype.titleReplace=function(e){var t="";return void 0===(t=this.language==WPGlobusCoreData.default_language?p("#title").val():p("#title_"+this.language).val())&&(t=YoastSEO.app.rawData.pageTitle),this.language!=WPGlobusCoreData.default_language&&0==t.length&&(t=p("#title").val()),e=e.replace(/%%title%%/g,t)},s.prototype.doubleSepReplace=function(e){var t=YoastSEO.app.stringHelper.addEscapeChars(this.replaceVars.sep),a=new RegExp(t+" "+t,"g");return e=e.replace(a,this.replaceVars.sep)},s.prototype.updateWpseoKeyword=function(e,t){0<p("#wpseo-meta-section-content_"+t+" .wpseo-keyword").length&&p("#wpseo-meta-section-content_"+t+" .wpseo-keyword").removeClass("wpseo-keyword").addClass("wpglobus-wpseo_keyword_"+t),p(".wpglobus-wpseo_keyword_"+t).text(e)},s.prototype.updatePageAnalysis=function(){p("#wpseo-pageanalysis_"+d.getWPseoTab()).html(p("#wpseo-pageanalysis").html()),p("#yoast-seo-content-analysis_"+d.getWPseoTab()).html(p("#yoast-seo-content-analysis").html()),p("#yoast-seo-content-analysis_"+d.getWPseoTab()+" li a").css({float:"none"})},window.WPGlobusYoastSeoPlugin=new s}});
includes/js/wpglobus-yoastseo-38.min.js CHANGED
@@ -1 +1 @@
1
- var WPGlobusYoastSeo;jQuery(document).ready(function(e){"use strict";if("undefined"!=typeof wpseoReplaceVarsL10n&&"undefined"!=typeof WPGlobusCoreData&&"undefined"!=typeof WPGlobusVendor){var t;if("edit-tags.php"==WPGlobusVendor.pagenow||"term.php"==WPGlobusVendor.pagenow){t=WPGlobusYoastSeo={editorIDs:["description"],editor:{},submitId:"#submit",preventChangeEditor:!1,observer:null,init:function(){t.attachListeners(),_.delay(t.start,1500)},submit:function(a){"mouseenter"===a.type?e.each(t.editor,function(a,s){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(t.editor[a].content):tinymce.get(a).setContent(t.editor[a].content)}):"mouseleave"===a.type?t.preventChangeEditor||(e.each(t.editor,function(a,s){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(WPGlobusCore.TextFilter(s.content,t.getCurrentTab(),"RETURN_EMPTY")):tinymce.get(a).setContent(WPGlobusCore.TextFilter(s.content,t.getCurrentTab(),"RETURN_EMPTY"))}),t.preventChangeEditor=!1):"click"===a.type&&(t.preventChangeEditor=!0,"tinymce"!=getUserSetting("editor")&&setUserSetting("editor","tinymce"))},attachListeners:function(){e(".wrap").on("tabsactivate",function(a,s){e.each(t.editor,function(a,o){!t.editor[a].contentEditor||t.editor[a].contentEditor.isHidden()?e("#"+a).val(WPGlobusCore.TextFilter(o.content,s.newTab[0].dataset.language,"RETURN_EMPTY")):tinymce.get(a).setContent(WPGlobusCore.TextFilter(o.content,s.newTab[0].dataset.language,"RETURN_EMPTY"))})}),e(document).on("mouseenter",t.submitId,t.submit).on("mouseleave",t.submitId,t.submit).on("click",t.submitId,t.submit),e(document).on("tinymce-editor-init",function(a,s){if(-1!=_.indexOf(t.editorIDs,s.id)){var o=e("#"+s.id);t.editor[s.id]={},t.editor[s.id].contentEditor=s,t.editor[s.id].content=o.val(),s.setContent(WPGlobusCore.TextFilter(t.editor[s.id].content,WPGlobusCoreData.default_language,"RETURN_EMPTY")),e("#"+s.getContainer().id).find("iframe").addClass("wpglobus-translatable"),o.removeClass("hidden"),s.on("nodechange keyup",_.debounce(t.update,500)),o.on("input keyup",_.debounce(t.update,500))}})},update:function(a){var s,o;void 0!==a.target&&("tinymce"==(s=a.target.id)&&(s=a.target.dataset.id),void 0!==t.editor[s].contentEditor&&(o=!t.editor[s].contentEditor||t.editor[s].contentEditor.isHidden()?e("#"+s).val():t.editor[s].contentEditor.getContent({format:"raw"}),t.editor[s].content=WPGlobusCore.getString(t.editor[s].content,o,t.getCurrentTab())))},getCurrentTab:function(){return e(".wpglobus-taxonomy-tabs-list .ui-tabs-active").data("language")},start:function(){e(".wpglobus-element_description").css({display:"none"})}},WPGlobusYoastSeo.init();var a=function(){e(".wrap").on("tabsactivate",function(t,a){a.newTab[0].dataset.language==WPGlobusCoreData.default_language?e("#poststuff .inside").css({display:"block"}):e("#poststuff .inside").css({display:"none"})}),e.each(["category_description","sitedesc","sitename","tag_description","term_description","term_title"],function(e,t){wpseoReplaceVarsL10n.replace_vars[t]=WPGlobusCore.TextFilter(wpseoReplaceVarsL10n.replace_vars[t],WPGlobusCoreData.default_language)}),WPGlobusYoastSeo.observer=new MutationObserver(function(t){t.forEach(function(t){if("placeholder"==t.attributeName){WPGlobusYoastSeo.observer.disconnect();var a=e("#wpseo_focuskw");""==a.val()&&a.attr("placeholder",WPGlobusCore.TextFilter(a.attr("placeholder"),WPGlobusCoreData.default_language)),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})}})}),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})};window.WPGlobusYoastSeoPlugin=new a}else{t=WPGlobusYoastSeo={wpseoTabSelector:"#wpglobus-wpseo-tabs",url:"",attrs:e("#wpglobus-wpseo-attr"),iB:e("#wpseo-meta-section-content"),t:e("#wpseo-meta-section-content"),ids:"",names:"",editSnippetButtonClass:"wpglobus-snippet-editor__edit-button",editSnippetFormClass:"wpglobus-snippet-editor__form",editSnippetSubmitClass:"wpglobus-snippet-editor__submit",editSnippetHeadingClass:"wpglobus-snippet-editor__heading-editor",yoastTitleProgress:"wpglobus-yoast-title-progress",yoastMetadescProgress:"wpglobus-yoast-metadesc-progress",init:function(){t.start()},initAddKeywordPopup:function(){1===e("#wpseo-add-keyword-popup").length&&e(".wpseo-add-keyword").on("click",t.addKeywordPopup)},addKeywordPopup:function(){var t=e("#wpseo-add-keyword-popup-button").text();tb_show(t,"#TB_inline?width=650&height=350&inlineId=wpseo-add-keyword-popup","group"),jQuery("#TB_window").css("height",235),jQuery("#TB_window").css("width",680)},qtip:function(){e(".yoast_help").qtip({content:{attr:"alt"},position:{my:"bottom left",at:"top center"},style:{tip:{corner:!0},classes:"yoast-qtip qtip-rounded qtip-blue"},show:"click",hide:{fixed:!0,delay:500}})},removeClasses:function(e,t){_.each(t,function(t){e.removeClass(t)})},updateProgressBar:function(a,s){if(void 0!==a&&(void 0!==s||("undefined"!==a.data("language")&&(s=a.data("language")),void 0!==s))){var o,i=["snippet-editor__progress--bad","snippet-editor__progress--ok","snippet-editor__progress--good"],n=0,p="",l=0,r=!1;n=a.val().length,a.hasClass("wpglobus-snippet-editor-title")?(l=(o=e("progress."+t.yoastTitleProgress+"_"+s)).attr("max"),p=i[2],0==n?p=i[1]:n>l?(p=i[1],r=!0):n>0&&n<35&&(p=i[1])):a.hasClass("wpglobus-snippet-editor-meta-description")&&(l=(o=e("progress."+t.yoastMetadescProgress+"_"+s)).attr("max"),p=i[2],0==n?p=i[1]:n>l?(p=i[1],r=!0):n>0&&n<121&&(p=i[1])),t.removeClasses(o,i),o.attr("value",n).addClass(p),r?a.css("color","#f00"):a.css("color","#000")}},updateWpseoKeyword:function(t,a){e("#wpseo-meta-section-content_"+a+" .wpseo-keyword").text(t)},start:function(){e(t.wpseoTabSelector).tabs(),t.ids=t.attrs.data("ids"),t.names=t.attrs.data("names"),t.ids=t.ids+","+t.attrs.data("qtip"),t.ids=t.ids.split(","),t.names=t.names.split(","),e("#wpglobus-wpseo-tabs").insertBefore(t.iB),e(".wpseo-metabox-tabs").css({height:"26px"}),e(".wpglobus-wpseo-general").each(function(a,s){var o=e(s),i=o.data("language"),n="wpseo-meta-section-content_"+i;o.html('<div id="'+n+'" class="wpseo-meta-section wpglobus-wpseo-meta-section" style="width:100%" data-language="'+i+'">'+t.t.html()+"</div>"),e("#"+n+" .wpseo-metabox-tabs").attr("id","wpseo-metabox-tabs_"+i).attr("data-language",i),e("#"+n+" .wpseotab").attr("id","wpseo_content_"+i),e("#wpseo_content_"+i).css({float:"left"}),e("#"+n).css({display:"block"}),e("#wpseo_meta").css({overflow:"hidden"}),e("#"+n+" .snippet_container").addClass("wpglobus-snippet_container"),i!==WPGlobusCoreData.default_language&&e("#"+n+" .wpseo-add-keyword").addClass("hidden"),e.each(t.names,function(t,a){e("#"+a).attr("name",a+"_"+i)}),e.each(t.ids,function(a,s){var o=e("#"+s);"wpseosnippet"==s&&o.addClass("wpglobus-wpseosnippet"),"snippet_title"==s&&o.addClass("wpglobus-snippet_title"),"snippet_meta"==s&&o.addClass("wpglobus-snippet_meta"),"snippet_cite"==s&&o.addClass("wpglobus-snippet_cite"),"snippet_citeBase"==s&&o.addClass("wpglobus-snippet_citeBase"),"url_container"==s&&o.css({height:"16px"}),"yoast_wpseo_focuskw_text_input"==s&&o.addClass("wpglobus-yoast_wpseo_focuskw_text_input"),"wpseo-pageanalysis"==s&&o.addClass("wpglobus-wpseo-pageanalysis"),"yoast-seo-content-analysis"==s&&o.addClass("wpglobus-yoast-seo-content-analysis"),"snippet_preview"==s&&o.addClass("wpglobus-snippet_preview"),"snippet-editor-title"==s&&(o.addClass("wpglobus-snippet-editor-title"),o.parent("label").attr("for",o.parent("label").attr("for")+"_"+i),o.val(e("#wpseo-tab-"+i).data("wpseotitle")),o.parent("label").next("progress").addClass(t.yoastTitleProgress).addClass(t.yoastTitleProgress+"_"+i),_.debounce(t.updateProgressBar(o,i),500)),"snippet-editor-slug"==s&&(o.addClass("wpglobus-snippet-editor-slug"),o.parent("label").attr("for",o.parent("label").attr("for")+"_"+i),WPGlobusCoreData.default_language!=i&&o.attr("disabled","disabled")),"snippet-editor-meta-description"==s&&(o.addClass("wpglobus-snippet-editor-meta-description"),o.parent("label").attr("for",o.parent("label").attr("for")+"_"+i),o.val(e("#wpseo-tab-"+i).data("metadesc")),o.parent("label").next("progress").addClass(t.yoastMetadescProgress).addClass(t.yoastMetadescProgress+"_"+i),_.debounce(t.updateProgressBar(o,i),500)),"snippetpreview-help-toggle"==s&&(o.addClass("wpglobus-snippetpreview-help-toggle_"+i),e(document).on("click",".wpglobus-snippetpreview-help-toggle_"+i,function(t){var a=e(this);"none"===e("#snippetpreview-help_"+a.data("language")).css("display")?e("#snippetpreview-help_"+a.data("language")).css({display:"block"}):e("#snippetpreview-help_"+a.data("language")).css({display:"none"})})),"focuskw_text_input-help-toggle"==s&&(o.addClass("wpglobus-focuskw_text_input-help-toggle_"+i),e(document).on("click",".wpglobus-focuskw_text_input-help-toggle_"+i,function(t){var a=e(this);"none"===e("#focuskw_text_input-help_"+a.data("language")).css("display")?e("#focuskw_text_input-help_"+a.data("language")).css({display:"block"}):e("#focuskw_text_input-help_"+a.data("language")).css({display:"none"})})),"pageanalysis-help-toggle"==s&&(o.addClass("wpglobus-pageanalysis-help-toggle_"+i),e(document).on("click",".wpglobus-pageanalysis-help-toggle_"+i,function(t){var a=e(this);"none"===e("#pageanalysis-help_"+a.data("language")).css("display")?e("#pageanalysis-help_"+a.data("language")).css({display:"block"}):e("#pageanalysis-help_"+a.data("language")).css({display:"none"})})),o.attr("id",s+"_"+i),e("#"+s+"_"+i).attr("data-language",i)});var p=WPGlobusCore.TextFilter(e("#yoast_wpseo_focuskw_text_input").val(),i,"RETURN_EMPTY");e("#yoast_wpseo_focuskw_text_input_"+i).val(p),e("#yoast_wpseo_focuskw_"+i).val(p),t.updateWpseoKeyword(p,i),i!==WPGlobusCoreData.default_language&&(e("#"+n+" #yoast_wpseo_focuskw_text_input_"+i).addClass("hidden").after('<div class="wpglobus-suggest" style="font-weight:bold;">'+WPGlobusVendor.i18n.yoastseo_plus_access+"</div>"),e("#"+n+" #wpseo-pageanalysis_"+i).addClass("hidden").css({display:"none"}))}),e(".wpglobus-wpseosnippet").each(function(a,s){var o=e(s),i=o.data("language");o.find("button.snippet-editor__button.snippet-editor__edit-button").addClass(t.editSnippetButtonClass).addClass(t.editSnippetButtonClass+"_"+i).attr("data-language",i),o.find(".snippet-editor__form").addClass(t.editSnippetFormClass).addClass(t.editSnippetFormClass+"_"+i),o.find(".snippet-editor__heading-editor").addClass(t.editSnippetHeadingClass).addClass(t.editSnippetHeadingClass+"_"+i),o.find(".snippet-editor__submit").addClass(t.editSnippetSubmitClass).addClass(t.editSnippetSubmitClass+"_"+i).attr("data-language",i)}),t.iB.addClass("hidden"),t.iB.css({height:0,overflow:"hidden",display:"none"});var o=WPGlobusCore.TextFilter(e("#yoast_wpseo_focuskw_text_input").val(),WPGlobusCoreData.default_language,"RETURN_EMPTY");e("#yoast_wpseo_focuskw_text_input").val(o),e("#yoast_wpseo_focuskw").val(o),e(".wpglobus-wpseo-general .wpseo_tablink").on("click",function(t){t.preventDefault();var a=e(this),s=a.parents("ul").data("language"),o=a.parent("li");s!=WPGlobusCoreData.default_language&&void 0===e(document).triggerHandler("wpglobus_yoast_analysis",{language:s})||(o.hasClass("wpseo_generic_tab")?(e("#wpseo-pageanalysis_"+s).css({display:"none"}),e("#yoast-seo-content-analysis_"+s).css({display:"block"}),e("#wpseo_content_"+s+" table tr").eq(0).css({display:"none"}),e("#wpseo_content_"+s+" table tr").eq(1).css({display:"none"}),e("#yoast-seo-content-analysis_"+s+" li a").css({float:"none"})):o.hasClass("wpseo_keyword_tab")&&(e("#wpseo-pageanalysis_"+s).css({display:"block"}),e("#yoast-seo-content-analysis_"+s).css({display:"none"}),e("#wpseo_content_"+s+" table tr").eq(0).css("display",""),e("#wpseo_content_"+s+" table tr").eq(1).css("display","")))}),e(".wpseo-metabox-sidebar .wpseo-meta-section-link").on("click",function(t){"#wpseo-meta-section-content"==e(this).attr("href")?e("#wpglobus-wpseo-tabs").css({display:"block"}):e("#wpglobus-wpseo-tabs").css({display:"none"})}),e("body").on("click","."+t.editSnippetButtonClass,function(a){var s=e(this),o=s.data("language"),i=e("."+t.editSnippetFormClass+"_"+o),n=e("."+t.editSnippetSubmitClass+"_"+o),p=e("."+t.editSnippetHeadingClass+"_"+o);i.hasClass("snippet-editor--hidden")?(i.removeClass("snippet-editor--hidden"),p.removeClass("snippet-editor--hidden"),n.removeClass("snippet-editor--hidden")):(i.addClass("snippet-editor--hidden"),p.addClass("snippet-editor--hidden")),s.addClass("snippet-editor--hidden")}),e("body").on("click","."+t.editSnippetSubmitClass,function(a){var s=e(this).data("language"),o=e("."+t.editSnippetButtonClass+"_"+s),i=e("."+t.editSnippetFormClass+"_"+s),n=e("."+t.editSnippetSubmitClass+"_"+s),p=e("."+t.editSnippetHeadingClass+"_"+s);o.removeClass("snippet-editor--hidden"),i.addClass("snippet-editor--hidden"),n.addClass("snippet-editor--hidden"),p.addClass("snippet-editor--hidden")}),e(document).on("keyup","input.wpglobus-snippet-editor-title",function(a){var o=e(this),i=o.data("language"),n=WPGlobusCore.getString(e('input[name="yoast_wpseo_title"]').val(),o.val(),i);e("#snippet_title_"+i).html(s.replaceVariablesPlugin(o.val())),YoastSEO.app.rawData.pageTitle=n,e('input[name="yoast_wpseo_title"]').val(n),e("#snippet_title").text(n),_.debounce(t.updateProgressBar(o,i),500)}),e(document).on("keyup","input.wpglobus-snippet-editor-slug",function(t){var a=e(this),s=a.data("language");e("#snippet_cite_"+s).text(a.val()+"/"),e("#editable-post-name").text(a.val()),e("#editable-post-name-full").text(a.val())}),e(document).on("change","input.wpglobus-snippet-editor-slug",function(t){var a=e(this);e.post(ajaxurl,{action:"sample-permalink",post_id:e("#post_ID").val()||0,new_slug:a.val(),new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()})}),e(document).on("keyup","textarea.wpglobus-snippet-editor-meta-description",function(a){var s=e(this),o=s.data("language");e("#snippet_meta_"+o).text(s.val());var i=WPGlobusCore.getString(e("#yoast_wpseo_metadesc").val(),s.val(),s.data("language"));e("#yoast_wpseo_metadesc").val(i),e("#snippet_meta").text(i),_.debounce(t.updateProgressBar(s,o),500)}),e("body").on("click",".wpglobus-post-body-tabs-list li",function(t){var s=e(this);if(s.hasClass("wpglobus-post-tab")){e("#wpglobus-wpseo-tabs").tabs("option","active",s.data("order"));var o=e("#yoast_wpseo_focuskw_text_input_"+e(this).data("language")).val();YoastSEO.app.rawData.keyword=o,e("#yoast_wpseo_focuskw_text_input").val(o),e('input[name="yoast_wpseo_focuskw"]').val(o),a.prototype.analyze()}}),t.initAddKeywordPopup()}};var s;(a=function(){this.replaceVars=wpseoReplaceVarsL10n.replace_vars,this.language=WPGlobusCoreData.default_language,this.tab=WPGlobusCoreData.default_language,this.wpseoTab=WPGlobusCoreData.default_language,this.title_template=wpseoPostScraperL10n.title_template,this.focuskw=e("#yoast_wpseo_focuskw_text_input"),this.focuskw_hidden=e('input[name="yoast_wpseo_focuskw"]'),this.focuskwKeep=!1,this.post_slug="#editable-post-name-full",YoastSEO.app.registerPlugin("wpglobusYoastSeoPlugin",{status:"ready"}),YoastSEO.app.registerModification("content",this.contentModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("title",this.titleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_title",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_meta",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_page_title",this.pageTitleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_meta_desc",this.metaDescModification,"wpglobusYoastSeoPlugin",0),a.prototype.setScoreIcon(),e(document).on("blur",".wpglobus-snippet_title",function(t){var a=e(this),s=WPGlobusCore.getString(e("#yoast_wpseo_title").val(),a.text(),a.data("language"));YoastSEO.app.rawData.pageTitle=s,e('input[name="yoast_wpseo_title"]').val(s),e("#snippet_title").text(s)}),e(document).on("blur",".wpglobus-snippet_meta",function(t){var a=e(this),s=WPGlobusCore.getString(e("#yoast_wpseo_metadesc").val(),a.text(),a.data("language"));e("#yoast_wpseo_metadesc").val(s),e("#snippet_meta").text(s)}),e(document).on("keyup",".wpglobus-yoast_wpseo_focuskw_text_input",function(t){var o=e(this),i=o.val();s.focuskw.val(i),s.focuskw_hidden.val(i),s.updateWpseoKeyword(i,o.data("language")),a.prototype.analyze()}),e("#publish,#save-post").on("mouseenter",function(t){var a,o="";e(".wpglobus-yoast_wpseo_focuskw_text_input").each(function(t,s){a=e(this),o=WPGlobusCore.getString(o,a.val(),a.data("language"))}),s.focuskw.val(o),s.focuskw_hidden.val(o)}).on("mouseleave",function(t){if(!s.focuskwKeep){s.wpseoTab=e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");e(this);s.focuskw.val(e("#yoast_wpseo_focuskw_text_input_"+s.wpseoTab).val()),s.focuskw_hidden.val(e("#yoast_wpseo_focuskw_text_input_"+s.wpseoTab).val())}}).on("click",function(e){s.focuskwKeep=!0}),e(WPGlobusYoastSeo.wpseoTabSelector).on("tabsactivate",function(t,o){if(s.language=o.newPanel.attr("data-language"),o.newPanel.attr("data-language")===WPGlobusCoreData.default_language){var i=e("#yoast_wpseo_focuskw_text_input_"+WPGlobusCoreData.default_language).val();YoastSEO.app.rawData.keyword=i,s.focuskw.val(i),s.focuskw_hidden.val(i)}a.prototype.analyze()}),s=this}).prototype.analyze=function(){var t=e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");t==WPGlobusCoreData.default_language?YoastSEO.app.snippetPreview.data.urlPath=e("#editable-post-name-full").text():0!=e("#editable-post-name-full-"+t).length?YoastSEO.app.snippetPreview.data.urlPath=e("#editable-post-name-full-"+t).text():YoastSEO.app.snippetPreview.data.urlPath=e("#editable-post-name-full").text(),YoastSEO.app.analyzeTimer(YoastSEO.app),a.prototype.setScoreIcon()},a.prototype.setScoreIcon=function(){var t;t=setInterval(function(){var a=e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language"),s=e("#wpseo-meta-section-content .wpseo_generic_tab a").data("score"),o=e("#wpseo-meta-section-content .wpseo_keyword_tab a").data("score");""!=s&&(e("#wpseo-metabox-tabs_"+a+" .wpseo_generic_tab .wpseo-score-icon").removeClass("bad ok good 100 na"),e("#wpseo-metabox-tabs_"+a+" .wpseo_generic_tab .wpseo-score-icon").addClass(s)),""!=o&&(e("#wpseo-metabox-tabs_"+a+" .wpseo_keyword_tab .wpseo-score-icon").removeClass("bad ok good 100 na"),e("#wpseo-metabox-tabs_"+a+" .wpseo_keyword_tab .wpseo-score-icon").addClass(o)),clearInterval(t)},1500)},a.prototype.getWPseoTab=function(){return e(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language")},a.prototype.citeModification=function(t){var a="#snippet_citeBase_"+t,s="#snippet_cite_"+t,o=e("#wpseo-tab-"+t).data("yoast-cite-base");!1===e("#wpseo-tab-"+t).data("cite-contenteditable")&&e(s).attr("contenteditable","false"),e(a).text(o)},a.prototype.pageTitleModification=function(t){var a,o,i,n="#snippet_title_",p="",l="";if(s.title_template==t)e.each(WPGlobusCoreData.enabled_languages,function(t,a){o=e("#snippet-editor-title_"+a).val(),i=0==o.length?s.title_template:o,p=s.replaceVariablesPlugin(i),e(n+a).text(p),a==s.getWPseoTab()&&(l=p)});else{if(a=WPGlobusCore.getTranslations(t),s.getWPseoTab()!==WPGlobusCoreData.default_language&&a[WPGlobusCoreData.default_language]==t){var r=s.getWPseoTab();return o=e("#snippet-editor-title_"+r).val(),i=o.length>0?o:s.title_template,i=s.replaceVariablesPlugin(i),e(n+r).text(i),i}e.each(WPGlobusCoreData.enabled_languages,function(t,i){p=""===a[i]?s.replaceVariablesPlugin(s.title_template):s.replaceVariablesPlugin(a[i]),i==s.getWPseoTab()&&(l=p,0!=(o=e("#snippet-editor-title_"+i).val()).length?o!=l&&(l=s.replaceVariablesPlugin(o)):l=s.replaceVariablesPlugin(s.title_template)),e(n+i).html(l)})}return l},a.prototype.metaDescModification=function(t){var a="#snippet_meta_",o="",i=WPGlobusCore.getTranslations(t),n="";if(o=e("#snippet-editor-meta-description_"+s.getWPseoTab()).val(),s.getWPseoTab()!==WPGlobusCoreData.default_language&&i[WPGlobusCoreData.default_language]==t){var p=s.getWPseoTab();return s.citeModification(p),0==o.length?e(a+p).text(""):o!=t&&e(a+p).text(o),t}return e.each(WPGlobusCoreData.enabled_languages,function(o,i){e(a+i).text(WPGlobusCore.TextFilter(t,i,"RETURN_EMPTY")),s.citeModification(i)}),o==i[s.getWPseoTab()]?0==(n=i[s.getWPseoTab()]).length&&e(a+s.getWPseoTab()).text(WPGlobusCore.TextFilter(YoastSEO.app.snippetPreview.data.metaDesc,WPGlobusCoreData.default_language,"RETURN_EMPTY")):0==(n=o).length?e(a+s.getWPseoTab()).text(WPGlobusCore.TextFilter(YoastSEO.app.snippetPreview.data.metaDesc,WPGlobusCoreData.default_language,"RETURN_EMPTY")):e(a+s.getWPseoTab()).text(n),e(a+s.getWPseoTab()).text(n),n},a.prototype.snippetModification=function(e){return WPGlobusCore.TextFilter(e,s.getWPseoTab(),"RETURN_EMPTY")},a.prototype.contentModification=function(t){return s.getWPseoTab()==WPGlobusCoreData.default_language?t:e("#content_"+s.getWPseoTab()).val()},a.prototype.titleModification=function(t){return setTimeout(s.updatePageAnalysis,1e3),s.getWPseoTab()==WPGlobusCoreData.default_language?t:e("#title_"+s.getWPseoTab()).val()},a.prototype.defaultReplace=function(e){var t=YoastSEO.app.rawData.keyword;return e.replace(/%%sitedesc%%/g,this.replaceVars.sitedesc).replace(/%%sitename%%/g,WPGlobusCore.TextFilter(this.replaceVars.sitename,s.getWPseoTab())).replace(/%%term_title%%/g,this.replaceVars.term_title).replace(/%%term_description%%/g,this.replaceVars.term_description).replace(/%%category_description%%/g,this.replaceVars.category_description).replace(/%%tag_description%%/g,this.replaceVars.tag_description).replace(/%%searchphrase%%/g,this.replaceVars.searchphrase).replace(/%%date%%/g,this.replaceVars.date).replace(/%%id%%/g,this.replaceVars.id).replace(/%%page%%/g,this.replaceVars.page).replace(/%%currenttime%%/g,this.replaceVars.currenttime).replace(/%%currentdate%%/g,this.replaceVars.currentdate).replace(/%%currentday%%/g,this.replaceVars.currentday).replace(/%%currentmonth%%/g,this.replaceVars.currentmonth).replace(/%%currentyear%%/g,this.replaceVars.currentyear).replace(/%%focuskw%%/g,t)},a.prototype.replaceVariablesPlugin=function(e){return void 0!==e&&(e=this.titleReplace(e),e=this.defaultReplace(e),e=this.replaceSeparators(e)),e},a.prototype.replaceSeparators=function(e){return e.replace(/%%sep%%(\s+%%sep%%)*/g,this.replaceVars.sep)},a.prototype.titleReplace=function(t){var a="";return void 0===(a=this.language==WPGlobusCoreData.default_language?e("#title").val():e("#title_"+this.language).val())&&(a=YoastSEO.app.rawData.pageTitle),this.language!=WPGlobusCoreData.default_language&&0==a.length&&(a=e("#title").val()),t=t.replace(/%%title%%/g,a)},a.prototype.doubleSepReplace=function(e){var t=YoastSEO.app.stringHelper.addEscapeChars(this.replaceVars.sep),a=new RegExp(t+" "+t,"g");return e=e.replace(a,this.replaceVars.sep)},a.prototype.updateWpseoKeyword=function(t,a){e("#wpseo-meta-section-content_"+a+" .wpseo-keyword").length>0&&e("#wpseo-meta-section-content_"+a+" .wpseo-keyword").removeClass("wpseo-keyword").addClass("wpglobus-wpseo_keyword_"+a),e(".wpglobus-wpseo_keyword_"+a).text(t)},a.prototype.updatePageAnalysis=function(){e("#wpseo-pageanalysis_"+s.getWPseoTab()).html(e("#wpseo-pageanalysis").html()),e("#yoast-seo-content-analysis_"+s.getWPseoTab()).html(e("#yoast-seo-content-analysis").html()),e("#yoast-seo-content-analysis_"+s.getWPseoTab()+" li a").css({float:"none"})},window.WPGlobusYoastSeoPlugin=new a}}});
1
+ var WPGlobusYoastSeo;jQuery(document).ready(function(l){"use strict";var r;if("undefined"!=typeof wpseoReplaceVarsL10n&&("undefined"!=typeof WPGlobusCoreData&&"undefined"!=typeof WPGlobusVendor))if("edit-tags.php"==WPGlobusVendor.pagenow||"term.php"==WPGlobusVendor.pagenow){r=WPGlobusYoastSeo={editorIDs:["description"],editor:{},submitId:"#submit",preventChangeEditor:!1,observer:null,init:function(){r.attachListeners(),_.delay(r.start,1500)},submit:function(e){"mouseenter"===e.type?l.each(r.editor,function(e,t){!r.editor[e].contentEditor||r.editor[e].contentEditor.isHidden()?l("#"+e).val(r.editor[e].content):tinymce.get(e).setContent(r.editor[e].content)}):"mouseleave"===e.type?r.preventChangeEditor||(l.each(r.editor,function(e,t){!r.editor[e].contentEditor||r.editor[e].contentEditor.isHidden()?l("#"+e).val(WPGlobusCore.TextFilter(t.content,r.getCurrentTab(),"RETURN_EMPTY")):tinymce.get(e).setContent(WPGlobusCore.TextFilter(t.content,r.getCurrentTab(),"RETURN_EMPTY"))}),r.preventChangeEditor=!1):"click"===e.type&&(r.preventChangeEditor=!0,"tinymce"!=getUserSetting("editor")&&setUserSetting("editor","tinymce"))},attachListeners:function(){l(".wrap").on("tabsactivate",function(e,a){l.each(r.editor,function(e,t){!r.editor[e].contentEditor||r.editor[e].contentEditor.isHidden()?l("#"+e).val(WPGlobusCore.TextFilter(t.content,a.newTab[0].dataset.language,"RETURN_EMPTY")):tinymce.get(e).setContent(WPGlobusCore.TextFilter(t.content,a.newTab[0].dataset.language,"RETURN_EMPTY"))})}),l(document).on("mouseenter",r.submitId,r.submit).on("mouseleave",r.submitId,r.submit).on("click",r.submitId,r.submit),l(document).on("tinymce-editor-init",function(e,t){if(-1!=_.indexOf(r.editorIDs,t.id)){var a=l("#"+t.id);r.editor[t.id]={},r.editor[t.id].contentEditor=t,r.editor[t.id].content=a.val(),t.setContent(WPGlobusCore.TextFilter(r.editor[t.id].content,WPGlobusCoreData.default_language,"RETURN_EMPTY")),l("#"+t.getContainer().id).find("iframe").addClass("wpglobus-translatable"),a.removeClass("hidden"),t.on("nodechange keyup",_.debounce(r.update,500)),a.on("input keyup",_.debounce(r.update,500))}})},update:function(e){var t,a;void 0!==e.target&&("tinymce"==(t=e.target.id)&&(t=e.target.dataset.id),void 0!==r.editor[t].contentEditor&&(a=!r.editor[t].contentEditor||r.editor[t].contentEditor.isHidden()?l("#"+t).val():r.editor[t].contentEditor.getContent({format:"raw"}),r.editor[t].content=WPGlobusCore.getString(r.editor[t].content,a,r.getCurrentTab())))},getCurrentTab:function(){return l(".wpglobus-taxonomy-tabs-list .ui-tabs-active").data("language")},start:function(){l(".wpglobus-element_description").css({display:"none"})}},WPGlobusYoastSeo.init();var s=function(){l(".wrap").on("tabsactivate",function(e,t){t.newTab[0].dataset.language==WPGlobusCoreData.default_language?l("#poststuff .inside").css({display:"block"}):l("#poststuff .inside").css({display:"none"})}),l.each(["category_description","sitedesc","sitename","tag_description","term_description","term_title"],function(e,t){wpseoReplaceVarsL10n.replace_vars[t]=WPGlobusCore.TextFilter(wpseoReplaceVarsL10n.replace_vars[t],WPGlobusCoreData.default_language)}),WPGlobusYoastSeo.observer=new MutationObserver(function(e){e.forEach(function(e){if("placeholder"==e.attributeName){WPGlobusYoastSeo.observer.disconnect();var t=l("#wpseo_focuskw");""==t.val()&&t.attr("placeholder",WPGlobusCore.TextFilter(t.attr("placeholder"),WPGlobusCoreData.default_language)),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})}})}),WPGlobusYoastSeo.observer.observe(document.querySelector("#wpseo_focuskw"),{attributes:!0,childList:!0,characterData:!0})};window.WPGlobusYoastSeoPlugin=new s}else{var d;r=WPGlobusYoastSeo={wpseoTabSelector:"#wpglobus-wpseo-tabs",url:"",attrs:l("#wpglobus-wpseo-attr"),iB:l("#wpseo-meta-section-content"),t:l("#wpseo-meta-section-content"),ids:"",names:"",editSnippetButtonClass:"wpglobus-snippet-editor__edit-button",editSnippetFormClass:"wpglobus-snippet-editor__form",editSnippetSubmitClass:"wpglobus-snippet-editor__submit",editSnippetHeadingClass:"wpglobus-snippet-editor__heading-editor",yoastTitleProgress:"wpglobus-yoast-title-progress",yoastMetadescProgress:"wpglobus-yoast-metadesc-progress",init:function(){r.start()},initAddKeywordPopup:function(){1===l("#wpseo-add-keyword-popup").length&&l(".wpseo-add-keyword").on("click",r.addKeywordPopup)},addKeywordPopup:function(){var e=l("#wpseo-add-keyword-popup-button").text();tb_show(e,"#TB_inline?width=650&height=350&inlineId=wpseo-add-keyword-popup","group"),jQuery("#TB_window").css("height",235),jQuery("#TB_window").css("width",680)},qtip:function(){l(".yoast_help").qtip({content:{attr:"alt"},position:{my:"bottom left",at:"top center"},style:{tip:{corner:!0},classes:"yoast-qtip qtip-rounded qtip-blue"},show:"click",hide:{fixed:!0,delay:500}})},removeClasses:function(t,e){_.each(e,function(e){t.removeClass(e)})},updateProgressBar:function(e,t){if(void 0!==e&&(void 0!==t||("undefined"!==e.data("language")&&(t=e.data("language")),void 0!==t))){var a,s,o=["snippet-editor__progress--bad","snippet-editor__progress--ok","snippet-editor__progress--good"],i="",n=0,p=!1;s=e.val().length,e.hasClass("wpglobus-snippet-editor-title")?(n=(a=l("progress."+r.yoastTitleProgress+"_"+t)).attr("max"),i=o[2],0==s?i=o[1]:n<s?(i=o[1],p=!0):0<s&&s<35&&(i=o[1])):e.hasClass("wpglobus-snippet-editor-meta-description")&&(n=(a=l("progress."+r.yoastMetadescProgress+"_"+t)).attr("max"),i=o[2],0==s?i=o[1]:n<s?(i=o[1],p=!0):0<s&&s<121&&(i=o[1])),r.removeClasses(a,o),a.attr("value",s).addClass(i),p?e.css("color","#f00"):e.css("color","#000")}},updateWpseoKeyword:function(e,t){l("#wpseo-meta-section-content_"+t+" .wpseo-keyword").text(e)},start:function(){l(r.wpseoTabSelector).tabs(),r.ids=r.attrs.data("ids"),r.names=r.attrs.data("names"),r.ids=r.ids+","+r.attrs.data("qtip"),r.ids=r.ids.split(","),r.names=r.names.split(","),l("#wpglobus-wpseo-tabs").insertBefore(r.iB),l(".wpseo-metabox-tabs").css({height:"26px"}),l(".wpglobus-wpseo-general").each(function(e,t){var a=l(t),s=a.data("language"),o="wpseo-meta-section-content_"+s;a.html('<div id="'+o+'" class="wpseo-meta-section wpglobus-wpseo-meta-section" style="width:100%" data-language="'+s+'">'+r.t.html()+"</div>"),l("#"+o+" .wpseo-metabox-tabs").attr("id","wpseo-metabox-tabs_"+s).attr("data-language",s),l("#"+o+" .wpseotab").attr("id","wpseo_content_"+s),l("#wpseo_content_"+s).css({float:"left"}),l("#"+o).css({display:"block"}),l("#wpseo_meta").css({overflow:"hidden"}),l("#"+o+" .snippet_container").addClass("wpglobus-snippet_container"),s!==WPGlobusCoreData.default_language&&l("#"+o+" .wpseo-add-keyword").addClass("hidden"),l.each(r.names,function(e,t){l("#"+t).attr("name",t+"_"+s)}),l.each(r.ids,function(e,t){var a=l("#"+t);"wpseosnippet"==t&&a.addClass("wpglobus-wpseosnippet"),"snippet_title"==t&&a.addClass("wpglobus-snippet_title"),"snippet_meta"==t&&a.addClass("wpglobus-snippet_meta"),"snippet_cite"==t&&a.addClass("wpglobus-snippet_cite"),"snippet_citeBase"==t&&a.addClass("wpglobus-snippet_citeBase"),"url_container"==t&&a.css({height:"16px"}),"yoast_wpseo_focuskw_text_input"==t&&a.addClass("wpglobus-yoast_wpseo_focuskw_text_input"),"wpseo-pageanalysis"==t&&a.addClass("wpglobus-wpseo-pageanalysis"),"yoast-seo-content-analysis"==t&&a.addClass("wpglobus-yoast-seo-content-analysis"),"snippet_preview"==t&&a.addClass("wpglobus-snippet_preview"),"snippet-editor-title"==t&&(a.addClass("wpglobus-snippet-editor-title"),a.parent("label").attr("for",a.parent("label").attr("for")+"_"+s),a.val(l("#wpseo-tab-"+s).data("wpseotitle")),a.parent("label").next("progress").addClass(r.yoastTitleProgress).addClass(r.yoastTitleProgress+"_"+s),_.debounce(r.updateProgressBar(a,s),500)),"snippet-editor-slug"==t&&(a.addClass("wpglobus-snippet-editor-slug"),a.parent("label").attr("for",a.parent("label").attr("for")+"_"+s),WPGlobusCoreData.default_language!=s&&a.attr("disabled","disabled")),"snippet-editor-meta-description"==t&&(a.addClass("wpglobus-snippet-editor-meta-description"),a.parent("label").attr("for",a.parent("label").attr("for")+"_"+s),a.val(l("#wpseo-tab-"+s).data("metadesc")),a.parent("label").next("progress").addClass(r.yoastMetadescProgress).addClass(r.yoastMetadescProgress+"_"+s),_.debounce(r.updateProgressBar(a,s),500)),"snippetpreview-help-toggle"==t&&(a.addClass("wpglobus-snippetpreview-help-toggle_"+s),l(document).on("click",".wpglobus-snippetpreview-help-toggle_"+s,function(e){var t=l(this);"none"===l("#snippetpreview-help_"+t.data("language")).css("display")?l("#snippetpreview-help_"+t.data("language")).css({display:"block"}):l("#snippetpreview-help_"+t.data("language")).css({display:"none"})})),"focuskw_text_input-help-toggle"==t&&(a.addClass("wpglobus-focuskw_text_input-help-toggle_"+s),l(document).on("click",".wpglobus-focuskw_text_input-help-toggle_"+s,function(e){var t=l(this);"none"===l("#focuskw_text_input-help_"+t.data("language")).css("display")?l("#focuskw_text_input-help_"+t.data("language")).css({display:"block"}):l("#focuskw_text_input-help_"+t.data("language")).css({display:"none"})})),"pageanalysis-help-toggle"==t&&(a.addClass("wpglobus-pageanalysis-help-toggle_"+s),l(document).on("click",".wpglobus-pageanalysis-help-toggle_"+s,function(e){var t=l(this);"none"===l("#pageanalysis-help_"+t.data("language")).css("display")?l("#pageanalysis-help_"+t.data("language")).css({display:"block"}):l("#pageanalysis-help_"+t.data("language")).css({display:"none"})})),a.attr("id",t+"_"+s),l("#"+t+"_"+s).attr("data-language",s)});var i=WPGlobusCore.TextFilter(l("#yoast_wpseo_focuskw_text_input").val(),s,"RETURN_EMPTY");l("#yoast_wpseo_focuskw_text_input_"+s).val(i),l("#yoast_wpseo_focuskw_"+s).val(i),r.updateWpseoKeyword(i,s),s!==WPGlobusCoreData.default_language&&(l("#"+o+" #yoast_wpseo_focuskw_text_input_"+s).addClass("hidden").after('<div class="wpglobus-suggest" style="font-weight:bold;">'+WPGlobusVendor.i18n.yoastseo_plus_access+"</div>"),l("#"+o+" #wpseo-pageanalysis_"+s).addClass("hidden").css({display:"none"}))}),l(".wpglobus-wpseosnippet").each(function(e,t){var a=l(t),s=a.data("language");a.find("button.snippet-editor__button.snippet-editor__edit-button").addClass(r.editSnippetButtonClass).addClass(r.editSnippetButtonClass+"_"+s).attr("data-language",s),a.find(".snippet-editor__form").addClass(r.editSnippetFormClass).addClass(r.editSnippetFormClass+"_"+s),a.find(".snippet-editor__heading-editor").addClass(r.editSnippetHeadingClass).addClass(r.editSnippetHeadingClass+"_"+s),a.find(".snippet-editor__submit").addClass(r.editSnippetSubmitClass).addClass(r.editSnippetSubmitClass+"_"+s).attr("data-language",s)}),r.iB.addClass("hidden"),r.iB.css({height:0,overflow:"hidden",display:"none"});var e=WPGlobusCore.TextFilter(l("#yoast_wpseo_focuskw_text_input").val(),WPGlobusCoreData.default_language,"RETURN_EMPTY");l("#yoast_wpseo_focuskw_text_input").val(e),l("#yoast_wpseo_focuskw").val(e),l(".wpglobus-wpseo-general .wpseo_tablink").on("click",function(e){e.preventDefault();var t=l(this),a=t.parents("ul").data("language"),s=t.parent("li");a!=WPGlobusCoreData.default_language&&void 0===l(document).triggerHandler("wpglobus_yoast_analysis",{language:a})||(s.hasClass("wpseo_generic_tab")?(l("#wpseo-pageanalysis_"+a).css({display:"none"}),l("#yoast-seo-content-analysis_"+a).css({display:"block"}),l("#wpseo_content_"+a+" table tr").eq(0).css({display:"none"}),l("#wpseo_content_"+a+" table tr").eq(1).css({display:"none"}),l("#yoast-seo-content-analysis_"+a+" li a").css({float:"none"})):s.hasClass("wpseo_keyword_tab")&&(l("#wpseo-pageanalysis_"+a).css({display:"block"}),l("#yoast-seo-content-analysis_"+a).css({display:"none"}),l("#wpseo_content_"+a+" table tr").eq(0).css("display",""),l("#wpseo_content_"+a+" table tr").eq(1).css("display","")))}),l(".wpseo-metabox-sidebar .wpseo-meta-section-link").on("click",function(e){"#wpseo-meta-section-content"==l(this).attr("href")?l("#wpglobus-wpseo-tabs").css({display:"block"}):l("#wpglobus-wpseo-tabs").css({display:"none"})}),l("body").on("click","."+r.editSnippetButtonClass,function(e){var t=l(this),a=t.data("language"),s=l("."+r.editSnippetFormClass+"_"+a),o=l("."+r.editSnippetSubmitClass+"_"+a),i=l("."+r.editSnippetHeadingClass+"_"+a);s.hasClass("snippet-editor--hidden")?(s.removeClass("snippet-editor--hidden"),i.removeClass("snippet-editor--hidden"),o.removeClass("snippet-editor--hidden")):(s.addClass("snippet-editor--hidden"),i.addClass("snippet-editor--hidden")),t.addClass("snippet-editor--hidden")}),l("body").on("click","."+r.editSnippetSubmitClass,function(e){var t=l(this).data("language"),a=l("."+r.editSnippetButtonClass+"_"+t),s=l("."+r.editSnippetFormClass+"_"+t),o=l("."+r.editSnippetSubmitClass+"_"+t),i=l("."+r.editSnippetHeadingClass+"_"+t);a.removeClass("snippet-editor--hidden"),s.addClass("snippet-editor--hidden"),o.addClass("snippet-editor--hidden"),i.addClass("snippet-editor--hidden")}),l(document).on("keyup","input.wpglobus-snippet-editor-title",function(e){var t=l(this),a=t.data("language"),s=WPGlobusCore.getString(l('input[name="yoast_wpseo_title"]').val(),t.val(),a);l("#snippet_title_"+a).html(d.replaceVariablesPlugin(t.val())),YoastSEO.app.rawData.pageTitle=s,l('input[name="yoast_wpseo_title"]').val(s),l("#snippet_title").text(s),_.debounce(r.updateProgressBar(t,a),500)}),l(document).on("keyup","input.wpglobus-snippet-editor-slug",function(e){var t=l(this),a=t.data("language");l("#snippet_cite_"+a).text(t.val()+"/"),l("#editable-post-name").text(t.val()),l("#editable-post-name-full").text(t.val())}),l(document).on("change","input.wpglobus-snippet-editor-slug",function(e){var t=l(this);l.post(ajaxurl,{action:"sample-permalink",post_id:l("#post_ID").val()||0,new_slug:t.val(),new_title:l("#title").val(),samplepermalinknonce:l("#samplepermalinknonce").val()})}),l(document).on("keyup","textarea.wpglobus-snippet-editor-meta-description",function(e){var t=l(this),a=t.data("language");l("#snippet_meta_"+a).text(t.val());var s=WPGlobusCore.getString(l("#yoast_wpseo_metadesc").val(),t.val(),t.data("language"));l("#yoast_wpseo_metadesc").val(s),l("#snippet_meta").text(s),_.debounce(r.updateProgressBar(t,a),500)}),l("body").on("click",".wpglobus-post-body-tabs-list li",function(e){var t=l(this);if(t.hasClass("wpglobus-post-tab")){l("#wpglobus-wpseo-tabs").tabs("option","active",t.data("order"));var a=l("#yoast_wpseo_focuskw_text_input_"+l(this).data("language")).val();YoastSEO.app.rawData.keyword=a,l("#yoast_wpseo_focuskw_text_input").val(a),l('input[name="yoast_wpseo_focuskw"]').val(a),s.prototype.analyze()}}),r.initAddKeywordPopup()}},(s=function(){this.replaceVars=wpseoReplaceVarsL10n.replace_vars,this.language=WPGlobusCoreData.default_language,this.tab=WPGlobusCoreData.default_language,this.wpseoTab=WPGlobusCoreData.default_language,this.title_template=wpseoPostScraperL10n.title_template,this.focuskw=l("#yoast_wpseo_focuskw_text_input"),this.focuskw_hidden=l('input[name="yoast_wpseo_focuskw"]'),this.focuskwKeep=!1,this.post_slug="#editable-post-name-full",YoastSEO.app.registerPlugin("wpglobusYoastSeoPlugin",{status:"ready"}),YoastSEO.app.registerModification("content",this.contentModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("title",this.titleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_title",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("snippet_meta",this.snippetModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_page_title",this.pageTitleModification,"wpglobusYoastSeoPlugin",0),YoastSEO.app.registerModification("data_meta_desc",this.metaDescModification,"wpglobusYoastSeoPlugin",0),s.prototype.setScoreIcon(),l(document).on("blur",".wpglobus-snippet_title",function(e){var t=l(this),a=WPGlobusCore.getString(l("#yoast_wpseo_title").val(),t.text(),t.data("language"));YoastSEO.app.rawData.pageTitle=a,l('input[name="yoast_wpseo_title"]').val(a),l("#snippet_title").text(a)}),l(document).on("blur",".wpglobus-snippet_meta",function(e){var t=l(this),a=WPGlobusCore.getString(l("#yoast_wpseo_metadesc").val(),t.text(),t.data("language"));l("#yoast_wpseo_metadesc").val(a),l("#snippet_meta").text(a)}),l(document).on("keyup",".wpglobus-yoast_wpseo_focuskw_text_input",function(e){var t=l(this),a=t.val();d.focuskw.val(a),d.focuskw_hidden.val(a),d.updateWpseoKeyword(a,t.data("language")),s.prototype.analyze()}),l("#publish,#save-post").on("mouseenter",function(e){var a,s="";l(".wpglobus-yoast_wpseo_focuskw_text_input").each(function(e,t){a=l(this),s=WPGlobusCore.getString(s,a.val(),a.data("language"))}),d.focuskw.val(s),d.focuskw_hidden.val(s)}).on("mouseleave",function(e){if(!d.focuskwKeep){d.wpseoTab=l(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");l(this);d.focuskw.val(l("#yoast_wpseo_focuskw_text_input_"+d.wpseoTab).val()),d.focuskw_hidden.val(l("#yoast_wpseo_focuskw_text_input_"+d.wpseoTab).val())}}).on("click",function(e){d.focuskwKeep=!0}),l(WPGlobusYoastSeo.wpseoTabSelector).on("tabsactivate",function(e,t){if(d.language=t.newPanel.attr("data-language"),t.newPanel.attr("data-language")===WPGlobusCoreData.default_language){var a=l("#yoast_wpseo_focuskw_text_input_"+WPGlobusCoreData.default_language).val();YoastSEO.app.rawData.keyword=a,d.focuskw.val(a),d.focuskw_hidden.val(a)}s.prototype.analyze()}),d=this}).prototype.analyze=function(){var e=l(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language");e==WPGlobusCoreData.default_language?YoastSEO.app.snippetPreview.data.urlPath=l("#editable-post-name-full").text():0!=l("#editable-post-name-full-"+e).length?YoastSEO.app.snippetPreview.data.urlPath=l("#editable-post-name-full-"+e).text():YoastSEO.app.snippetPreview.data.urlPath=l("#editable-post-name-full").text(),YoastSEO.app.analyzeTimer(YoastSEO.app),s.prototype.setScoreIcon()},s.prototype.setScoreIcon=function(){var s;s=setInterval(function(){var e=l(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language"),t=l("#wpseo-meta-section-content .wpseo_generic_tab a").data("score"),a=l("#wpseo-meta-section-content .wpseo_keyword_tab a").data("score");""!=t&&(l("#wpseo-metabox-tabs_"+e+" .wpseo_generic_tab .wpseo-score-icon").removeClass("bad ok good 100 na"),l("#wpseo-metabox-tabs_"+e+" .wpseo_generic_tab .wpseo-score-icon").addClass(t)),""!=a&&(l("#wpseo-metabox-tabs_"+e+" .wpseo_keyword_tab .wpseo-score-icon").removeClass("bad ok good 100 na"),l("#wpseo-metabox-tabs_"+e+" .wpseo_keyword_tab .wpseo-score-icon").addClass(a)),clearInterval(s)},1500)},s.prototype.getWPseoTab=function(){return l(".wpglobus-wpseo-tabs-list .ui-tabs-active").data("language")},s.prototype.citeModification=function(e){var t="#snippet_citeBase_"+e,a="#snippet_cite_"+e,s=l("#wpseo-tab-"+e).data("yoast-cite-base");!1===l("#wpseo-tab-"+e).data("cite-contenteditable")&&l(a).attr("contenteditable","false"),l(t).text(s)},s.prototype.pageTitleModification=function(e){var a,s,o,i="#snippet_title_",n="",p="";if(d.title_template==e)l.each(WPGlobusCoreData.enabled_languages,function(e,t){s=l("#snippet-editor-title_"+t).val(),o=0==s.length?d.title_template:s,n=d.replaceVariablesPlugin(o),l(i+t).text(n),t==d.getWPseoTab()&&(p=n)});else{if(a=WPGlobusCore.getTranslations(e),d.getWPseoTab()!==WPGlobusCoreData.default_language&&a[WPGlobusCoreData.default_language]==e){var t=d.getWPseoTab();return s=l("#snippet-editor-title_"+t).val(),o=0<s.length?s:d.title_template,o=d.replaceVariablesPlugin(o),l(i+t).text(o),o}l.each(WPGlobusCoreData.enabled_languages,function(e,t){n=""===a[t]?d.replaceVariablesPlugin(d.title_template):d.replaceVariablesPlugin(a[t]),t==d.getWPseoTab()&&(p=n,0!=(s=l("#snippet-editor-title_"+t).val()).length?s!=p&&(p=d.replaceVariabl