From 1c47d068c27d59d8a1361ca5e43377110bbd4ef2 Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Thu, 18 Jul 2019 15:08:35 -0600 Subject: [PATCH] Update for 1.5.0 --- CHANGELOG.md | 220 ++++++---- README.md | 95 +++-- composer.json | 4 +- dist/css/admin-pull-table.min.css | 2 +- dist/css/admin-pull-table.min.css.map | 2 +- dist/css/push.min.css | 2 +- dist/css/push.min.css.map | 2 +- dist/js/admin-distributed-post.min.js.map | 2 +- dist/js/admin-external-connection.min.js.map | 2 +- dist/js/admin-pull.min.js.map | 2 +- dist/js/gutenberg-status-plugin.min.js.map | 2 +- dist/js/gutenberg-syndicated-post.min.js.map | 2 +- dist/js/push.min.js | 2 +- dist/js/push.min.js.map | 2 +- distributor.php | 4 +- .../WordPressExternalConnection.php | 15 +- .../NetworkSiteConnection.php | 193 +++++---- includes/classes/PullListTable.php | 100 +++-- includes/push-ui.php | 388 ++++++++++-------- includes/rest-api.php | 8 +- includes/utils.php | 73 ++-- lang/distributor.pot | 4 +- .../plugin-update-checker/Puc/v4/Factory.php | 2 +- .../Puc/{v4p5 => v4p6}/Autoloader.php | 4 +- .../Puc/{v4p5 => v4p6}/DebugBar/Extension.php | 16 +- .../Puc/{v4p5 => v4p6}/DebugBar/Panel.php | 6 +- .../DebugBar/PluginExtension.php | 8 +- .../{v4p5 => v4p6}/DebugBar/PluginPanel.php | 6 +- .../{v4p5 => v4p6}/DebugBar/ThemePanel.php | 6 +- .../Puc/{v4p5 => v4p6}/Factory.php | 12 +- .../Puc/{v4p5 => v4p6}/InstalledPackage.php | 6 +- .../Puc/{v4p5 => v4p6}/Metadata.php | 4 +- .../Puc/{v4p5 => v4p6}/OAuthSignature.php | 4 +- .../Puc/{v4p5 => v4p6}/Plugin/Info.php | 4 +- .../Puc/{v4p5 => v4p6}/Plugin/Package.php | 10 +- .../Puc/{v4p5 => v4p6}/Plugin/Ui.php | 6 +- .../Puc/{v4p5 => v4p6}/Plugin/Update.php | 16 +- .../{v4p5 => v4p6}/Plugin/UpdateChecker.php | 34 +- .../Puc/{v4p5 => v4p6}/Scheduler.php | 72 +++- .../Puc/{v4p5 => v4p6}/StateStore.php | 18 +- .../Puc/{v4p5 => v4p6}/Theme/Package.php | 4 +- .../Puc/{v4p5 => v4p6}/Theme/Update.php | 8 +- .../{v4p5 => v4p6}/Theme/UpdateChecker.php | 20 +- .../Puc/{v4p5 => v4p6}/Update.php | 4 +- .../Puc/{v4p5 => v4p6}/UpdateChecker.php | 44 +- .../Puc/{v4p5 => v4p6}/UpgraderStatus.php | 4 +- .../Puc/{v4p5 => v4p6}/Utils.php | 4 +- .../Puc/{v4p5 => v4p6}/Vcs/Api.php | 14 +- .../Puc/{v4p5 => v4p6}/Vcs/BaseChecker.php | 6 +- .../Puc/{v4p5 => v4p6}/Vcs/BitBucketApi.php | 22 +- .../Puc/{v4p5 => v4p6}/Vcs/GitHubApi.php | 18 +- .../Puc/{v4p5 => v4p6}/Vcs/GitLabApi.php | 30 +- .../Vcs/PluginUpdateChecker.php | 16 +- .../Puc/{v4p5 => v4p6}/Vcs/Reference.php | 4 +- .../{v4p5 => v4p6}/Vcs/ThemeUpdateChecker.php | 18 +- .../plugin-update-checker/README.md | 4 +- .../plugin-update-checker.php | 36 +- 57 files changed, 947 insertions(+), 669 deletions(-) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Autoloader.php (94%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/DebugBar/Extension.php (91%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/DebugBar/Panel.php (96%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/DebugBar/PluginExtension.php (75%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/DebugBar/PluginPanel.php (82%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/DebugBar/ThemePanel.php (68%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Factory.php (96%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/InstalledPackage.php (95%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Metadata.php (97%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/OAuthSignature.php (96%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Plugin/Info.php (97%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Plugin/Package.php (94%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Plugin/Ui.php (98%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Plugin/Update.php (87%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Plugin/UpdateChecker.php (93%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Scheduler.php (72%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/StateStore.php (89%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Theme/Package.php (93%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Theme/Update.php (89%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Theme/UpdateChecker.php (87%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Update.php (84%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/UpdateChecker.php (96%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/UpgraderStatus.php (98%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Utils.php (96%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Vcs/Api.php (96%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Vcs/BaseChecker.php (75%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Vcs/BitBucketApi.php (92%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Vcs/GitHubApi.php (96%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Vcs/GitLabApi.php (90%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Vcs/PluginUpdateChecker.php (93%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Vcs/Reference.php (92%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p5 => v4p6}/Vcs/ThemeUpdateChecker.php (85%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c3f534f3..e97e866be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,131 +2,175 @@ All notable changes to this project will be documented in this file, per [the Keep a Changelog standard](http://keepachangelog.com/). -## [ 1.4.1 ] - 2019-03-15 +## [1.5.0] - 2019-07-18 +### Added +- Provide more context to the `dt_create_missing_terms` hook (props [@mmcachran](https://github.com/mmcachran) and [@helen](https://github.com/helen) via [#378](https://github.com/10up/distributor/pull/378)) +- Test against multiple WP Snapshot variations and block tests (props [@adamsilverstein](https://github.com/adamsilverstein) via [#342](https://github.com/10up/distributor/pull/342) and [#367](https://github.com/10up/distributor/pull/367)) +- Documentation improvements (props [@adamsilverstein](https://github.com/adamsilverstein), [@jeffpaul](https://github.com/jeffpaul), [@arsendovlatyan](https://github.com/arsendovlatyan) via [#352](https://github.com/10up/distributor/pull/352), [#363](https://github.com/10up/distributor/pull/363), [#403](https://github.com/10up/distributor/pull/403), [#414](https://github.com/10up/distributor/pull/414), [#415](https://github.com/10up/distributor/pull/415)) + +### Changed +- More efficient method of generating internal connection data on push and pull screens (props [@dkotter](https://github.com/dkotter) via [#355](https://github.com/10up/distributor/pull/355)) +- Lazy load available push connections in toolbar dropdown to avoid blocking page render (props [@dkotter](https://github.com/dkotter) via [#365](https://github.com/10up/distributor/pull/365)) +- More performant retrieval and consistent ordering on the pull content screen (props [@helen](https://github.com/helen) via [#431](https://github.com/10up/distributor/pull/431) and [#434](https://github.com/10up/distributor/pull/434)) +- Unify args provided to the `dt_push_post_args` filter (props [@gthayer](https://github.com/gthayer) via [#371](https://github.com/10up/distributor/pull/371)) +- Bumped WordPress version support to 5.2 (props [@adamsilverstein](https://github.com/adamsilverstein), [@jeffpaul](https://github.com/jeffpaul) via [#376](https://github.com/10up/distributor/pull/376)) + +### Fixed +- Avoid connection errors on the pull content screen for connections with a lot of pulled/skipped content (props [@helen](https://github.com/helen) via [#431](https://github.com/10up/distributor/pull/431)) +- Pass slug when distributing terms to avoid duplicating terms with special characters or custom slugs (props [@arsendovlatyan](https://github.com/arsendovlatyan) and [@helen](https://github.com/helen) via [#262](https://github.com/10up/distributor/pull/262)) +- Simplify and avoid a fatal error in `is_using_gutenberg()` (props [@helen](https://github.com/helen) via [#426](https://github.com/10up/distributor/pull/426)) +- Avoid PHP notices (props [@grappler](https://github.com/grappler) via [#401](https://github.com/10up/distributor/pull/401) and [@mrazzari](https://github.com/mrazzari) via [#420](https://github.com/10up/distributor/pull/420)) + +## [1.4.1] - 2019-03-15 ### Fixed -* Improve block editor detection, correcting an issue with post saving. +- Improve block editor detection, correcting an issue with post saving. -## [ 1.4.0 ] - 2019-03-07 +## [1.4.0] - 2019-03-07 ### Added -* Clearer instructions and help text when adding an external connection. -* Log image sideloading failures when using `DISTRIBUTOR_DEBUG`. +- Clearer instructions and help text when adding an external connection. +- Log image sideloading failures when using `DISTRIBUTOR_DEBUG`. ### Fixed -* Allow attachments to be distributed from local environments. -* Ensure pagination is reset when switching views on the pull content screen. -* Remove extraneous checkboxes from pulled content screen. -* Suppress a PHP warning when no meta is being distributed for attachments. +- Allow attachments to be distributed from local environments. +- Ensure pagination is reset when switching views on the pull content screen. +- Remove extraneous checkboxes from pulled content screen. +- Suppress a PHP warning when no meta is being distributed for attachments. -## [ 1.3.9 ] - 2019-02-21 +## [1.3.9] - 2019-02-21 ### Fixed -* Ensure posts distributed as draft can be published. +- Ensure posts distributed as draft can be published. -## [ 1.3.8 ] - 2019-01-30 +## [1.3.8] - 2019-01-30 ### Added -* Add `dt_after_set_meta` action. -* Add `dt_process_subscription_attributes` action. +- Add `dt_after_set_meta` action. +- Add `dt_process_subscription_attributes` action. ### Fixed -* Ensure post types without excerpt support can be distributed. +- Ensure post types without excerpt support can be distributed. -## [ 1.3.7 ] - 2019-01-16 +## [1.3.7] - 2019-01-16 ### Added -* Distribute plaintext URLs instead of full markup for automatic embeds (oEmbeds). This was causing issues for non-privileged users where the markup was subject to sanitization/kses. -* Add `push`/`pull` context to `get_available_authorized_sites()`. -* Add `dt_allowed_media_extensions` and `dt_media_processing_filename` filters so that different media types or specific files can be detected and targeted. +- Distribute plaintext URLs instead of full markup for automatic embeds (oEmbeds). This was causing issues for non-privileged users where the markup was subject to sanitization/kses. +- Add `push`/`pull` context to `get_available_authorized_sites()`. +- Add `dt_allowed_media_extensions` and `dt_media_processing_filename` filters so that different media types or specific files can be detected and targeted. ### Fixed -* Ensure media meta is passed through `prepare_meta()` to apply the blacklist. This completes the generated image size info fix from 1.3.3. -* Avoid a PHP notice when only using the block editor on the receiving site. -* Avoid a jQuery Migrate notice. +- Ensure media meta is passed through `prepare_meta()` to apply the blacklist. This completes the generated image size info fix from 1.3.3. +- Avoid a PHP notice when only using the block editor on the receiving site. +- Avoid a jQuery Migrate notice. -## [ 1.3.6 ] - 2018-12-19 +## [1.3.6] - 2018-12-19 ### Fixed (for WP 5.0 block editor) -* Properly detect block editor content. -* Show notices with actions. -* Ensure distributed posts can be published. -* Fully disable editing of classic blocks in distributed posts. -* Clean up distribution status display in side panel. -* Not block editor: Avoid notices on the pull content screen when no connections are set up yet. - -## [ 1.3.5 ] - 2018-12-05 +- Properly detect block editor content. +- Show notices with actions. +- Ensure distributed posts can be published. +- Fully disable editing of classic blocks in distributed posts. +- Clean up distribution status display in side panel. +- Not block editor: Avoid notices on the pull content screen when no connections are set up yet. + +## [1.3.5] - 2018-12-05 ### Added -* Add a `dt_available_pull_post_types` filter to enable pulling of post types not registered on the destination site. NOTE: This requires custom handling to pull into an existing post type. +- Add a `dt_available_pull_post_types` filter to enable pulling of post types not registered on the destination site. NOTE: This requires custom handling to pull into an existing post type. ### Fixed -* Avoid duplicating empty meta values. -* Align with JS i18n coming in WordPress 5.0. +- Avoid duplicating empty meta values. +- Align with JS i18n coming in WordPress 5.0. -## [ 1.3.4 ] - 2018-11-20 +## [1.3.4] - 2018-11-20 ### Added -* Provide `$taxonomy` to the `dt_update_term_hierarchy` filter. +- Provide `$taxonomy` to the `dt_update_term_hierarchy` filter. ### Fixed -* Enable distribution of multiple meta values stored using the same key. -* Retain comment status, pingback status, and post passwords on pull. +- Enable distribution of multiple meta values stored using the same key. +- Retain comment status, pingback status, and post passwords on pull. -## [ 1.3.3 ] - 2018-10-19 +## [1.3.3] - 2018-10-19 ### Fixed -* Do not interfere with non-subscription REST API requests. -* Retain generated image size info after media distribution. +- Do not interfere with non-subscription REST API requests. +- Retain generated image size info after media distribution. -## [ 1.3.2 ] - 2018-10-16 +## [1.3.2] - 2018-10-16 ### Fixed -* Correctly encode search query in the pull list. -* Properly check the key for subscription updates. -* Ensure featured images are properly detected from environments that type juggle. -* Add plugin icon to plugin update UI. +- Correctly encode search query in the pull list. +- Properly check the key for subscription updates. +- Ensure featured images are properly detected from environments that type juggle. +- Add plugin icon to plugin update UI. -## [ 1.3.1 ] - 2018-10-09 +## [1.3.1] - 2018-10-09 ### Fixed -* Retain keys for associative array meta. -* Properly pass CPT slugs to external connections. -* Don't push updates to network sites that no longer exist. -* Escaping improvements. -* Stable build now only contains files necessary for production. +- Retain keys for associative array meta. +- Properly pass CPT slugs to external connections. +- Don't push updates to network sites that no longer exist. +- Escaping improvements. +- Stable build now only contains files necessary for production. - -## [ 1.3.0 ] - 2018-09-20 +## [1.3.0] - 2018-09-20 ### Added -* Add a media processing option to only distribute the featured image instead of the featured image and all attached media. +- Add a media processing option to only distribute the featured image instead of the featured image and all attached media. **Important note**: This is now the default option **for all sites**. Attached media is often loosely correlated with media use and in-content media URLs are not rewritten on distribution, making local copies of most attached media unnecessary in default setups, even as they add significant overhead to distribution. To retain the previous behavior of distributing all attached media (children attachments), change the setting on the **receiving** site to `Process the featured image and any attached images.` -* Support pulling multiple post types for external connections. +- Support pulling multiple post types for external connections. This adds a post type selector when viewing the Pull Content list for both external and internal connections, which is both easier to use and more performant. -* Distributed copies of posts that are later permanently deleted are now marked as `skipped` in the Pull Content list, making them available for pull again while not appearing as new content. -* Add `dt_original_post_parent` to post meta, allowing developers to better manage post parent handling. +- Distributed copies of posts that are later permanently deleted are now marked as `skipped` in the Pull Content list, making them available for pull again while not appearing as new content. +- Add `dt_original_post_parent` to post meta, allowing developers to better manage post parent handling. + +### Fixed +- Restore support for storing arrays in meta +- Don't show pushed posts as available for pull on the receiving site +- Correctly save screen options on Distributor pages +- Removed a redundant argument +- Code formatting fixes +## [1.2.3] - 2018-08-16 ### Fixed -* Restore support for storing arrays in meta -* Don't show pushed posts as available for pull on the receiving site -* Correctly save screen options on Distributor pages -* Removed a redundant argument -* Code formatting fixes - -## [ 1.2.3 ] - 2018-08-16 -* Fixed an issue that was hiding the "As Draft" checkbox on the push screen. We've introduced a new filter "dt_allow_as_draft_distribute" which can be set to false to disable the "as draft" checkbox. - -## [ 1.2.2 ] - 2018-08-14 -* Fixed an issue where content pulled or skipped from an internal connection (in the Pull interface) would show up as "pulled" across all internal sites / connections. **Backwards compatibility break**: internal posts that were previously skipped or pulled will show as available for pull again in all internal sites. -* Don’t set Distributor meta data on REST API post creation unless post was created by Distributor -* Add helper function to return post statuses that are allowed to be distributed -* Utilize the og:url from Yoast for external connections -* Blacklist the `_wp_old_slug` and `_wp_old_date` meta -* Disable pull UI while switching between pull connections -* Add new filters for authorized sites for internal connections -* Documentation and formatting updates - -## [ 1.2.1 ] - 2018-07-06 -* Gutenberg bug fixes; fix parent post bug. - -## [ 1.2.0 ] - 2018-05-27 -* Gutenberg support, public release. - -## [ 1.1.0 ] - 2018-05-07 -* Enable WordPress.com Oauth2 authentication. - -## [ 1.0.0 ] -* Initial closed release. +- Issue that was hiding the "As Draft" checkbox on the push screen. We've introduced a new filter "dt_allow_as_draft_distribute" which can be set to false to disable the "as draft" checkbox. + +## [1.2.2] - 2018-08-14 +### Added +- Helper function to return post statuses that are allowed to be distributed +- Utilize the og:url from Yoast for external connections +- Add new filters for authorized sites for internal connections +- Documentation and formatting updates + +### Changed +- Don’t set Distributor meta data on REST API post creation unless post was created by Distributor +- Blacklist the `_wp_old_slug` and `_wp_old_date` meta +- Disable pull UI while switching between pull connections + +### Fixed +- Issue where content pulled or skipped from an internal connection (in the Pull interface) would show up as "pulled" across all internal sites / connections. **Backwards compatibility break**: internal posts that were previously skipped or pulled will show as available for pull again in all internal sites. + +## [1.2.1] - 2018-07-06 +### Fixed +- Gutenberg bugs; parent post bug. + +## [1.2.0] - 2018-05-27 +### Added +- Gutenberg support, public release. + +## [1.1.0] - 2018-05-07 +### Added +- WordPress.com Oauth2 authentication. + +## [1.0.0] +- Initial closed release. + +[1.5.0]: https://github.com/10up/distributor/compare/1.4.1...1.5.0 +[1.4.1]: https://github.com/10up/distributor/compare/1.4.0...1.4.1 +[1.4.0]: https://github.com/10up/distributor/compare/1.3.9...1.4.0 +[1.3.9]: https://github.com/10up/distributor/compare/1.3.8...1.3.9 +[1.3.8]: https://github.com/10up/distributor/compare/1.3.7...1.3.8 +[1.3.7]: https://github.com/10up/distributor/compare/1.3.6...1.3.7 +[1.3.6]: https://github.com/10up/distributor/compare/1.3.5...1.3.6 +[1.3.5]: https://github.com/10up/distributor/compare/1.3.4...1.3.5 +[1.3.4]: https://github.com/10up/distributor/compare/1.3.3...1.3.4 +[1.3.3]: https://github.com/10up/distributor/compare/1.3.2...1.3.3 +[1.3.2]: https://github.com/10up/distributor/compare/1.3.1...1.3.2 +[1.3.1]: https://github.com/10up/distributor/compare/1.3.0...1.3.1 +[1.3.0]: https://github.com/10up/distributor/compare/1.2.3...1.3.0 +[1.2.3]: https://github.com/10up/distributor/compare/1.2.2...1.2.3 +[1.2.2]: https://github.com/10up/distributor/releases/tag/1.2.2 +[1.1.0]: https://github.com/10up/distributor/releases/tag/archive%2Ffeature%2Fenable-oath2 diff --git a/README.md b/README.md index d6e354c87..d66b8d226 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,48 @@ -# Distributor [![Build Status](https://travis-ci.org/10up/distributor.svg?branch=master)](https://travis-ci.org/10up/distributor) -### [Download Latest Stable Version](https://github.com/10up/distributor/archive/stable.zip) -distributor icon Distributor is a WordPress plugin that makes it easy to syndicate and reuse content across your websites — whether in a single multisite or across the web. +Distributor icon + +# Distributor +> Distributor is a WordPress plugin that makes it easy to syndicate and reuse content across your websites — whether in a single multisite or across the web. + +[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Build Status](https://travis-ci.org/10up/distributor.svg?branch=master)](https://travis-ci.org/10up/distributor) +[![Release Version](https://img.shields.io/github/release/10up/distributor.svg)](https://github.com/10up/distributor/releases/latest) ![WordPress tested up to version](https://img.shields.io/badge/WordPress-v5.2%20tested-success.svg) [![License](https://img.shields.io/github/license/10up/distributor.svg)](https://github.com/10up/distributor/blob/develop/LICENSE.md) *You can learn more about Distributor's features at [DistributorPlugin.com](https://distributorplugin.com).* +_Note:_ The latest stable version of the plugin is the _stable_ branch. [Download the stable branch]((https://github.com/10up/distributor/archive/stable.zip)) if you are intending to use the plugin in production. + +## Table of Contents +* [Features](#features) + * [Gutenberg Support](#gutenberg-support-beta) +* [Requirements](#requirements) +* [Installation](#installation) + * [Registration](#registration) + * [Setup External Connections](#setup-external-connections-using-application-passwords) +* [Known Caveats/Issues](#known-caveatsissues) +* [Changelog](#changelog) +* [Contributing](#contributing) +* [Testing](#testing) +* [Debugging](#debugging) + +## Features + +Distributor supports safe, SEO-friendly content reuse and sharing via "pushing" and "pulling". + +While logged in and editing or viewing any single post (or custom post type) that can be distributed, a `Distributor` admin bar item will appear, that will facilitate sharing ("pushing") that content to any `connection`. Push the content you’re editing or viewing to any of your other sites from the admin bar +In the admin dashboard, a top level Distributor menu item links to the "pull" screen. Here, editors can share ("pull") content from any `connection` into the current site. +Pull content from another site from the Distributor admin menu + +Content this is distributed (via Push or Pull) is connected to the original. Reposted content receives updates from the original, canonical source automatically. Distributor intuitively presents the origin and status of any reused content -_Note:_ The latest stable version of the plugin is the _stable_ branch. [Download the stable branch]((https://github.com/10up/distributor/archive/stable.zip)) if you are intending to use the plugin in production. +There are two connection types: `internal` and `external`. +* Internal connections are other sites inside of the same multisite network. Any user logged into the network can distribute any content in the network to any other sites in the network where that user has permission to publish posts (assuming the site supports the same post type). +* External connections are external websites, connected by the JSON REST API. External connections can be added in the WordPress admin dashboard under Distributor > External Connections. Administrators can decide which user roles are allowed to distribute content to and from that connection (Editors and Administrators by default). All users with those roles will inherit the permissions of the user account used to establish the remote connection. + +### Gutenberg Support (Beta) + +Distributor supports distributing Gutenberg posts but the functionality is currently in beta. We expect this functionality to stabilize as Gutenberg further iterates within WordPress core. ## Requirements @@ -17,7 +51,7 @@ _Note:_ The latest stable version of the plugin is the _stable_ branch. [Downloa * External connections require HTTP Basic Authentication or [WordPress.com OAuth2](https://developer.wordpress.com/docs/oauth2/) (must be on VIP) be set up on the remote website. For Basic Auth, we recommend the [Application Passwords](https://wordpress.org/plugins/application-passwords/) plugin. * For external connections, Distributor needs to be installed on BOTH sides of the connection. -## Install +## Installation For production use, we recommend [registering and downloading the plugin from DistributorPlugin.com](https://distributorplugin.com/#cta) – it's 100% free. You will be emailed a direct link to download the latest, production-ready build. Alternatively, you can [download the latest master build from GitHub](https://github.com/10up/distributor/archive/master.zip). @@ -25,23 +59,20 @@ You can upload and install the archived (zip) plugin via the WordPress dashboard ### Registration -To help inform our roadmap, keep adopters apprised of major updates and changes that could impact their websites, and solicit opportunities for beta testing and feedback, we’re asking for a little bit of information in exchange for a free key that unlocks update notifications and 1-click upgrades inside the WordPress dashboard. Your information is kept confidential. You can [register here](https://distributorplugin.com/#cta) and input your key in Distributor settings in the dashboard (network dashboard for multisite users). - -## Plugin Usage +To help inform our roadmap, keep adopters apprised of major updates and changes that could impact their websites, and solicit opportunities for beta testing and feedback, we’re asking for a little bit of information in exchange for a free key that unlocks update notifications and 1-click upgrades inside the WordPress dashboard. Your information is kept confidential. You can [register here](https://distributorplugin.com/#cta) and input your key in Distributor settings in the dashboard (network dashboard for multisite users). Note that you need to input the email address you used to register Distributor (included in the email with your registration key) as that is linked to the registration key. -Distributor supports safe, SEO-friendly content reuse and sharing via "pushing" and "pulling". +### Setup External Connections using Application Passwords -While logged in and editing or viewing any single post (or custom post type) that can be distributed, a `Distributor` admin bar item will appear, that will facilitate sharing ("pushing") that content to any `connection`. +1. Ensure Distributor is installed on BOTH sites being connected. We'll refer to these as mainsite.com and remotesite.com. +2. On mainsite.com, navigate to `Distributor` > `External Connections` and click `Add New`. +3. Enter a label for the connection (e.g., `remotesite.com`), select `Username / Password` for the `Authentication Method`, and a username from remotesite.com. +4. On remotesite.com, ensure that [Application Passwords](https://wordpress.org/plugins/application-passwords/) is installed. Then navigate to the user profile that will be used to create the Externatal Connection on mainsite.com and then to the `Application Passwords` section of the user profile (not the `Account Management` section). Add a label for the New Application Password Name (e.g., `mainsite.com`) and click `Add New`. Now copy the password provided into mainsite.com's External Connections `Password` field. +5. On mainsite.com, add the `External Connection URL` (e.g., http://remotesite.com/wp-json). You should see a green circle and "_Connection established._". +6. Ensure the roles selected in `Roles Allowed to Push` are the ones you want to support, then press the `Create Connection` button. You should now be able to push from mainsite.com to remotesite.com. If you want to pull from remotesite.com to mainsite.com, simply repeat these instructions swapping mainsite.com and remotesite.com. -In the admin dashboard, a top level Distributor menu item links to the "pull" screen. Here, editors can share ("pull") content from any `connection` into the current site. +## Support Level -There are two connection types: `external` and `internal`. -* Internal connections are other sites inside of the same multisite network. Any user logged into the network can distribute any content in the network to any other sites in the network where that user has permission to publish posts (assuming the site supports the same post type). -* External connections are external websites, connected by the JSON REST API. External connections can be added in the WordPress admin dashboard under Distributor > External Connections. Administrators can decide which user roles are allowed to distribute content to and from that connection (Editors and Administrators by default). All users with those roles will inherit the permissions of the user account used to establish the remote connection. - -### Gutenberg Support (Beta) - -Distributor supports distributing Gutenberg posts but the functionality is currently in beta (as is Gutenberg itself). We expect this functionality to stabilize when Gutenberg is released into WordPress core. +**Active:** 10up is actively working on this, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome. ## Known Caveats/Issues @@ -55,24 +86,38 @@ __Gutenberg Block Mismatch__ - When distributing a Gutenberg post to another sit __Parent Posts__ - Distributor does not "bring along" parent (or child posts). If your post (or custom post type) has a parent or a child, it will distribute it as if it's an orphan. -__External Connection Post Type Support__ - When _pulling_ content from an external connection, only "Posts" (post type) content will appear. _Pulling_ other post types from _external_ connections is not currently supported. Internal connections (multisite) support multiple post types, and other post types can still be _pushed_ to external connections that support the post type. This will be addressed in an upcoming release, including an improved interface for navigating available content by post types supported on both sides. - -In addition, in order for distribution to work with external connections that have custom post type content, that post type needs to be registered with the argument `show_in_rest => true` on the external site. +__Custom Post Type Support__ - Internal Connections (multisite) support multiple post types. In order for distribution to work with External Connections that have custom post type content, that post type needs to be registered with the argument `show_in_rest => true` on the external site. __Backwards Compatibility__ - While we strive to be mindful of backwards compatibility much the same way WordPress itself is, we do not currently guarantee continued interoperability between different versions of Distributor. We assume the current userbase for this plugin has a high degree of control over any site that has been set up as an external connection and urge you to keep Distributor up to date. -## Developers +__Distributing Post content__ - By default, post content is rendered before being copied. This means that shortcodes are expanded before being distributed and remote posts will not have the shortcode, but rather the expanded HTML content. + +__Distributing Authors__ - By default, distributed stories reference the original site as the "author" with a link to it. This can be altered by extending Distributor with custom code to make it sync authors. + +__Distributing Post Date__ - By default, the "post date" on distributed stories is the date its published on the remote site, not the date published on the origin site. This can be overridden by extending Distributor with custom code to make it preserve the post date. + +__Distributing Canonical URL__ - By default, canonical URL of distributed post will point to original content, which corresponds to SEO best practices. This can be overridden by extending Distributor with custom code and removing Distributor's default front end canonical URL filtering (look for `'get_canonical_url'` and `'wpseo_canonical'`). + +__Drafts as preferred Status__ - By default, drafts are the preferred status and can't be changed at the source site. + +## Changelog + +A complete listing of all notable changes to Distributor are documented in [CHANGELOG.md](https://github.com/10up/distributor/blob/develop/CHANGELOG.md). + +## Contributing + +Please read [CODE_OF_CONDUCT.md](https://github.com/10up/distributor/blob/develop/CODE_OF_CONDUCT.md) for details on our code of conduct and [CONTRIBUTING.md](https://github.com/10up/distributor/blob/develop/CONTRIBUTING.md) for details on the process for submitting pull requests to us. -### Testing +## Testing The plugin contains a standard test suite compatible with PHPUnit. If you want to test across multiple PHP versions, a [Dockunit](https://github.com/dockunit/dockunit) file is included. -### Debugging +## Debugging You can define a constant `DISTRIBUTOR_DEBUG` to `true` to increase the ease of debugging in Distributor. This will make all remote requests blocking and expose the subscription post type. Enabling this will also provide more debugging information in your error log for image side loading issues. The specific logging method may change in the future. -### Work with us +## Like what you see? diff --git a/composer.json b/composer.json index ebe97cf90..d40fad516 100644 --- a/composer.json +++ b/composer.json @@ -17,10 +17,10 @@ } }, "require-dev": { - "10up/wpacceptance": "~0.12.0", "10up/wp_mock": "~0.4", "phpunit/phpunit": "~7.5", - "10up/phpcs-composer": "dev-master" + "10up/phpcs-composer": "dev-master", + "10up/wpacceptance": "dev-master" }, "scripts": { "lint": "./vendor/bin/phpcs . --runtime-set testVersion 5.6-", diff --git a/dist/css/admin-pull-table.min.css b/dist/css/admin-pull-table.min.css index e6bed6431..72d9c56b8 100644 --- a/dist/css/admin-pull-table.min.css +++ b/dist/css/admin-pull-table.min.css @@ -1,2 +1,2 @@ -.distributor_page_pull.dt-loading #posts-filter,.distributor_page_pull.dt-loading .subsubsub{opacity:.5;pointer-events:none;cursor:default}.status-sync .check-column{display:none} +.distributor_page_pull.dt-loading #posts-filter,.distributor_page_pull.dt-loading .subsubsub{opacity:.5;pointer-events:none;cursor:default}.wp-list-table .disabled{opacity:.7}.status-sync .check-column{display:none} /*# sourceMappingURL=admin-pull-table.min.css.map */ diff --git a/dist/css/admin-pull-table.min.css.map b/dist/css/admin-pull-table.min.css.map index dba28f188..f2ec70a62 100644 --- a/dist/css/admin-pull-table.min.css.map +++ b/dist/css/admin-pull-table.min.css.map @@ -1 +1 @@ -{"version":3,"names":[],"mappings":"","sources":["admin-pull-table.min.css"],"sourcesContent":[".distributor_page_pull.dt-loading #posts-filter,.distributor_page_pull.dt-loading .subsubsub{opacity:.5;pointer-events:none;cursor:default}.status-sync .check-column{display:none}"],"file":"admin-pull-table.min.css"} \ No newline at end of file +{"version":3,"names":[],"mappings":"","sources":["admin-pull-table.min.css"],"sourcesContent":[".distributor_page_pull.dt-loading #posts-filter,.distributor_page_pull.dt-loading .subsubsub{opacity:.5;pointer-events:none;cursor:default}.wp-list-table .disabled{opacity:.7}.status-sync .check-column{display:none}"],"file":"admin-pull-table.min.css"} \ No newline at end of file diff --git a/dist/css/push.min.css b/dist/css/push.min.css index 54b6b210e..2b89e60a2 100644 --- a/dist/css/push.min.css +++ b/dist/css/push.min.css @@ -1,2 +1,2 @@ -#distributor-push-wrapper{display:none}#wpadminbar #distributor-push-wrapper{display:none;font-size:13px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;top:32px;left:0;right:0;padding:2em 1em;height:auto;background-color:#32373c;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#eee;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;z-index:9999;-webkit-box-shadow:0 2px 1px 0 #000;box-shadow:0 2px 1px 0 #000;line-height:1.5}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{padding:2em 0}}#wpadminbar #distributor-push-wrapper *{line-height:1.5}.distributor-show #wp-admin-bar-distributor #distributor-push-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex}#wpadminbar #distributor-push-wrapper .inner{width:100%;max-width:768px;margin:0 auto}#wpadminbar #distributor-push-wrapper .new-connections-list{overflow:auto;border:1px solid #555;max-height:125px}#wpadminbar #distributor-push-wrapper .selected-connections-list{margin-bottom:1em}#wpadminbar #distributor-push-wrapper .connections-selected{margin-top:2em;position:relative}#wpadminbar #distributor-push-wrapper .connections-selected .no-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected.empty{opacity:.5}#wpadminbar #distributor-push-wrapper .connections-selected.empty .no-selected{display:block}#wpadminbar #distributor-push-wrapper .connections-selected.empty .with-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected label{color:inherit}#wpadminbar #distributor-push-wrapper .connections-selected input[type=checkbox]{vertical-align:middle;margin-right:2px}#wpadminbar #distributor-push-wrapper .connections-selected.empty:after{content:" ";position:absolute;top:0;left:0;right:0;bottom:0;background-color:transparent}#wpadminbar #distributor-push-wrapper .syndicated-notice a{display:inline-block;padding:0;margin:0}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{position:fixed}#wpadminbar #distributor-push-wrapper .connections-selector{width:60%;position:relative;float:left;padding-right:0;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}#wpadminbar #distributor-push-wrapper .connections-selector div{width:100%}#wpadminbar #distributor-push-wrapper .connections-selected{width:40%;float:right;margin-top:0;padding-left:3em;-webkit-box-sizing:border-box;box-sizing:border-box}}#wpadminbar #distributor-push-wrapper .no-connections-notice,#wpadminbar #distributor-push-wrapper .syndicated-notice{text-align:center;margin:0}#wpadminbar #distributor-push-wrapper .no-connections-notice a,#wpadminbar #distributor-push-wrapper .syndicated-notice a{color:inherit;text-decoration:underline}#wpadminbar #distributor-push-wrapper input[type=checkbox]{height:16px!important}#wpadminbar #distributor-push-wrapper input[type=text]{font-size:inherit;padding:.5278em;width:100%;background-color:#32373c;border:2px solid #555;color:#eee;margin-bottom:.5em}#wpadminbar #distributor-push-wrapper input[type=text]::-webkit-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:-ms-input-placeholder,#wpadminbar #distributor-push-wrapper input[type=text]::-ms-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]::placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:focus{color:#eee;background-color:#32373c;border:2px solid #555}#wpadminbar #distributor-push-wrapper button{background:#0085ba;border-color:#0073aa #006799 #006799;border-width:1px;border-style:solid;-webkit-box-shadow:0 1px 0 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799;height:30px;line-height:28px;padding:0 12px 2px;border-radius:3px;text-transform:none;font-size:13px;vertical-align:top;font-weight:400;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}#wpadminbar #distributor-push-wrapper button:focus,#wpadminbar #distributor-push-wrapper button:hover{background-color:#0085ba;outline:none}#wpadminbar #distributor-push-wrapper .new-connections-list>div:nth-child(odd){background-color:#23282d}#wpadminbar #distributor-push-wrapper .add-connection,#wpadminbar #distributor-push-wrapper .added-connection{display:block;width:100%;padding:.5em;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:pointer}#wpadminbar #distributor-push-wrapper .new-connections-list .add-connection.added{background-color:#3a4045}#wpadminbar #distributor-push-wrapper .add-connection.syndicated{cursor:default}#wpadminbar #distributor-push-wrapper .add-connection.syndicated span{color:#555}#wpadminbar #distributor-push-wrapper .add-connection.syndicated a{color:inherit;text-decoration:underline;float:right;height:auto}#wpadminbar #distributor-push-wrapper .added-connection{background-color:#555;margin-bottom:.5em;cursor:normal;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection{cursor:pointer;top:1px;display:inline-block;float:right;font-size:20px;line-height:19px;vertical-align:middle;margin-left:6px;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection:after{content:"\f335";font-family:dashicons}#wpadminbar #distributor-push-wrapper header,#wpadminbar #distributor-push-wrapper p{margin:0 0 1em!important;padding:0}#wpadminbar #distributor-push-wrapper .as-draft{margin-left:.5em;height:30px;line-height:28px;padding:2px 12px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box}#wpadminbar #distributor-push-wrapper .action-wrapper.loading .syndicate-button:after{content:" ";vertical-align:middle;border-radius:50%;width:6px;margin-left:8px;height:6px;display:inline-block;font-size:9px;text-indent:-9999em;border-top:3px solid #cfcfcf;border-right:3px solid #cfcfcf;border-bottom:3px solid #cfcfcf;border-left:3px solid #00aef2;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:a 1.1s infinite linear;animation:a 1.1s infinite linear;position:relative;top:-1px;-webkit-box-sizing:content-box;box-sizing:content-box;-webkit-box-sizing:initial;box-sizing:initial}#wpadminbar #distributor-push-wrapper .messages{margin-top:1em;-webkit-box-sizing:border-box;box-sizing:border-box}@media (min-width:480px){#wpadminbar #distributor-push-wrapper .messages{width:40%;float:right;clear:right;padding-left:3em}}#wpadminbar #distributor-push-wrapper .messages *{display:none}#wpadminbar #distributor-push-wrapper.message-error .messages .dt-error,#wpadminbar #distributor-push-wrapper.message-success .messages .dt-success{display:block}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}} +#distributor-push-wrapper{display:none}#wpadminbar #distributor-push-wrapper{display:none;font-size:13px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;top:32px;left:0;right:0;padding:2em 1em;height:auto;background-color:#32373c;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#eee;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;z-index:9999;-webkit-box-shadow:0 2px 1px 0 #000;box-shadow:0 2px 1px 0 #000;line-height:1.5}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{padding:2em 0}}#wpadminbar #distributor-push-wrapper *{line-height:1.5}.distributor-show #wp-admin-bar-distributor #distributor-push-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex}#wpadminbar #distributor-push-wrapper .inner{width:100%;max-width:768px;margin:0 auto}#wpadminbar #distributor-push-wrapper .new-connections-list{overflow:auto;border:1px solid #555;max-height:125px}#wpadminbar #distributor-push-wrapper .selected-connections-list{margin-bottom:1em}#wpadminbar #distributor-push-wrapper .connections-selected{margin-top:2em;position:relative}#wpadminbar #distributor-push-wrapper .connections-selected .no-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected.empty{opacity:.5}#wpadminbar #distributor-push-wrapper .connections-selected.empty .no-selected{display:block}#wpadminbar #distributor-push-wrapper .connections-selected.empty .with-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected label{color:inherit}#wpadminbar #distributor-push-wrapper .connections-selected input[type=checkbox]{vertical-align:middle;margin-right:2px}#wpadminbar #distributor-push-wrapper .connections-selected.empty:after{content:" ";position:absolute;top:0;left:0;right:0;bottom:0;background-color:transparent}#wpadminbar #distributor-push-wrapper .syndicated-notice a{display:inline-block;padding:0;margin:0}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{position:fixed}#wpadminbar #distributor-push-wrapper .connections-selector{width:60%;position:relative;float:left;padding-right:0;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}#wpadminbar #distributor-push-wrapper .connections-selector div{width:100%}#wpadminbar #distributor-push-wrapper .connections-selected{width:40%;float:right;margin-top:0;padding-left:3em;-webkit-box-sizing:border-box;box-sizing:border-box}}#wpadminbar #distributor-push-wrapper .no-connections-notice,#wpadminbar #distributor-push-wrapper .syndicated-notice{text-align:center;margin:0}#wpadminbar #distributor-push-wrapper .no-connections-notice a,#wpadminbar #distributor-push-wrapper .syndicated-notice a{color:inherit;text-decoration:underline}#wpadminbar #distributor-push-wrapper input[type=checkbox]{height:16px!important}#wpadminbar #distributor-push-wrapper input[type=text]{font-size:inherit;padding:.5278em;width:100%;background-color:#32373c;border:2px solid #555;color:#eee;margin-bottom:.5em}#wpadminbar #distributor-push-wrapper input[type=text]::-webkit-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:-ms-input-placeholder,#wpadminbar #distributor-push-wrapper input[type=text]::-ms-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]::placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:focus{color:#eee;background-color:#32373c;border:2px solid #555}#wpadminbar #distributor-push-wrapper button{background:#0085ba;border-color:#0073aa #006799 #006799;border-width:1px;border-style:solid;-webkit-box-shadow:0 1px 0 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799;height:30px;line-height:28px;padding:0 12px 2px;border-radius:3px;text-transform:none;font-size:13px;vertical-align:top;font-weight:400;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}#wpadminbar #distributor-push-wrapper button:focus,#wpadminbar #distributor-push-wrapper button:hover{background-color:#0085ba;outline:none}#wpadminbar #distributor-push-wrapper .new-connections-list>div:nth-child(odd){background-color:#23282d}#wpadminbar #distributor-push-wrapper .add-connection,#wpadminbar #distributor-push-wrapper .added-connection{display:block;width:100%;padding:.5em;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:pointer}#wpadminbar #distributor-push-wrapper .new-connections-list .add-connection.added{background-color:#3a4045}#wpadminbar #distributor-push-wrapper .add-connection.syndicated{cursor:default}#wpadminbar #distributor-push-wrapper .add-connection.syndicated span{color:#555}#wpadminbar #distributor-push-wrapper .add-connection.syndicated a{color:inherit;text-decoration:underline;float:right;height:auto}#wpadminbar #distributor-push-wrapper .added-connection{background-color:#555;margin-bottom:.5em;cursor:normal;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection{cursor:pointer;top:1px;display:inline-block;float:right;font-size:20px;line-height:19px;vertical-align:middle;margin-left:6px;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection:after{content:"\f335";font-family:dashicons}#wpadminbar #distributor-push-wrapper header,#wpadminbar #distributor-push-wrapper p{margin:0 0 1em!important;padding:0}#wpadminbar #distributor-push-wrapper .as-draft{margin-left:.5em;height:30px;line-height:28px;padding:2px 12px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box}#wpadminbar #distributor-push-wrapper .action-wrapper.loading .syndicate-button:after{content:" ";vertical-align:middle;border-radius:50%;width:6px;margin-left:8px;height:6px;display:inline-block;font-size:9px;text-indent:-9999em;border-top:3px solid #cfcfcf;border-right:3px solid #cfcfcf;border-bottom:3px solid #cfcfcf;border-left:3px solid #00aef2;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:a 1.1s infinite linear;animation:a 1.1s infinite linear;position:relative;top:-1px;-webkit-box-sizing:content-box;box-sizing:content-box;-webkit-box-sizing:initial;box-sizing:initial}#wpadminbar #distributor-push-wrapper .messages{margin-top:1em;-webkit-box-sizing:border-box;box-sizing:border-box}@media (min-width:480px){#wpadminbar #distributor-push-wrapper .messages{width:40%;float:right;clear:right;padding-left:3em}}#wpadminbar #distributor-push-wrapper .messages *{display:none}#wpadminbar #distributor-push-wrapper.message-error .messages .dt-error,#wpadminbar #distributor-push-wrapper.message-success .messages .dt-success{display:block}#distributor-push-wrapper .loader-item{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;overflow:hidden}#distributor-push-wrapper.message-error .loader-item{display:none}@media (min-width:480px){#wpadminbar #distributor-push-wrapper .loader-messages{width:100%;float:none;padding-left:0}}#distributor-push-wrapper .loader-item,#distributor-push-wrapper .loader-item *,#distributor-push-wrapper .loader-item :after,#distributor-push-wrapper .loader-item :before{-webkit-box-sizing:border-box;box-sizing:border-box}#distributor-push-wrapper .loader-item:before{content:" ";position:absolute;top:0;right:0;bottom:0;left:50%;z-index:1;width:349%;margin-left:-250%;-webkit-animation:b .8s linear infinite;animation:b .8s linear infinite;background:-webkit-gradient(linear,left top,right top,color-stop(46%,hsla(0,0%,100%,0)),color-stop(50%,hsla(0,0%,100%,.35)),color-stop(54%,hsla(0,0%,100%,0))) 50% 50%;background:linear-gradient(90deg,hsla(0,0%,100%,0) 46%,hsla(0,0%,100%,.35) 50%,hsla(0,0%,100%,0) 54%) 50% 50%}#distributor-push-wrapper .loader-item>*{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-flow:column;flex-flow:column}#distributor-push-wrapper .loader-row{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}#distributor-push-wrapper .loader-row.border{border:1px solid #555}#distributor-push-wrapper .loader-row div{height:15px}#distributor-push-wrapper .loader-row .big,#distributor-push-wrapper .loader-row.big div{height:30px}#distributor-push-wrapper .loader-row .odd{background-color:#23282d}#distributor-push-wrapper .loader-row .bottom{margin-bottom:15px}#distributor-push-wrapper .loader-col-4{-webkit-box-flex:0;-ms-flex:0 0 30%;flex:0 0 30%;padding-left:3em}#distributor-push-wrapper .loader-col-8{-webkit-box-flex:0;-ms-flex:0 0 60%;flex:0 0 60%}#distributor-push-wrapper .loader-col-12{-webkit-box-flex:0;-ms-flex:0 0 100%;flex:0 0 100%}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@-webkit-keyframes b{0%{-webkit-transform:translate3d(-30%,0,0);transform:translate3d(-30%,0,0)}to{-webkit-transform:translate3d(30%,0,0);transform:translate3d(30%,0,0)}}@keyframes b{0%{-webkit-transform:translate3d(-30%,0,0);transform:translate3d(-30%,0,0)}to{-webkit-transform:translate3d(30%,0,0);transform:translate3d(30%,0,0)}} /*# sourceMappingURL=push.min.css.map */ diff --git a/dist/css/push.min.css.map b/dist/css/push.min.css.map index 77abce9b3..ff236b690 100644 --- a/dist/css/push.min.css.map +++ b/dist/css/push.min.css.map @@ -1 +1 @@ -{"version":3,"names":[],"mappings":"","sources":["push.min.css"],"sourcesContent":["#distributor-push-wrapper{display:none}#wpadminbar #distributor-push-wrapper{display:none;font-size:13px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;top:32px;left:0;right:0;padding:2em 1em;height:auto;background-color:#32373c;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#eee;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;z-index:9999;-webkit-box-shadow:0 2px 1px 0 #000;box-shadow:0 2px 1px 0 #000;line-height:1.5}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{padding:2em 0}}#wpadminbar #distributor-push-wrapper *{line-height:1.5}.distributor-show #wp-admin-bar-distributor #distributor-push-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex}#wpadminbar #distributor-push-wrapper .inner{width:100%;max-width:768px;margin:0 auto}#wpadminbar #distributor-push-wrapper .new-connections-list{overflow:auto;border:1px solid #555;max-height:125px}#wpadminbar #distributor-push-wrapper .selected-connections-list{margin-bottom:1em}#wpadminbar #distributor-push-wrapper .connections-selected{margin-top:2em;position:relative}#wpadminbar #distributor-push-wrapper .connections-selected .no-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected.empty{opacity:.5}#wpadminbar #distributor-push-wrapper .connections-selected.empty .no-selected{display:block}#wpadminbar #distributor-push-wrapper .connections-selected.empty .with-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected label{color:inherit}#wpadminbar #distributor-push-wrapper .connections-selected input[type=checkbox]{vertical-align:middle;margin-right:2px}#wpadminbar #distributor-push-wrapper .connections-selected.empty:after{content:\" \";position:absolute;top:0;left:0;right:0;bottom:0;background-color:transparent}#wpadminbar #distributor-push-wrapper .syndicated-notice a{display:inline-block;padding:0;margin:0}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{position:fixed}#wpadminbar #distributor-push-wrapper .connections-selector{width:60%;position:relative;float:left;padding-right:0;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}#wpadminbar #distributor-push-wrapper .connections-selector div{width:100%}#wpadminbar #distributor-push-wrapper .connections-selected{width:40%;float:right;margin-top:0;padding-left:3em;-webkit-box-sizing:border-box;box-sizing:border-box}}#wpadminbar #distributor-push-wrapper .no-connections-notice,#wpadminbar #distributor-push-wrapper .syndicated-notice{text-align:center;margin:0}#wpadminbar #distributor-push-wrapper .no-connections-notice a,#wpadminbar #distributor-push-wrapper .syndicated-notice a{color:inherit;text-decoration:underline}#wpadminbar #distributor-push-wrapper input[type=checkbox]{height:16px!important}#wpadminbar #distributor-push-wrapper input[type=text]{font-size:inherit;padding:.5278em;width:100%;background-color:#32373c;border:2px solid #555;color:#eee;margin-bottom:.5em}#wpadminbar #distributor-push-wrapper input[type=text]::-webkit-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:-ms-input-placeholder,#wpadminbar #distributor-push-wrapper input[type=text]::-ms-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]::placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:focus{color:#eee;background-color:#32373c;border:2px solid #555}#wpadminbar #distributor-push-wrapper button{background:#0085ba;border-color:#0073aa #006799 #006799;border-width:1px;border-style:solid;-webkit-box-shadow:0 1px 0 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799;height:30px;line-height:28px;padding:0 12px 2px;border-radius:3px;text-transform:none;font-size:13px;vertical-align:top;font-weight:400;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}#wpadminbar #distributor-push-wrapper button:focus,#wpadminbar #distributor-push-wrapper button:hover{background-color:#0085ba;outline:none}#wpadminbar #distributor-push-wrapper .new-connections-list>div:nth-child(odd){background-color:#23282d}#wpadminbar #distributor-push-wrapper .add-connection,#wpadminbar #distributor-push-wrapper .added-connection{display:block;width:100%;padding:.5em;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:pointer}#wpadminbar #distributor-push-wrapper .new-connections-list .add-connection.added{background-color:#3a4045}#wpadminbar #distributor-push-wrapper .add-connection.syndicated{cursor:default}#wpadminbar #distributor-push-wrapper .add-connection.syndicated span{color:#555}#wpadminbar #distributor-push-wrapper .add-connection.syndicated a{color:inherit;text-decoration:underline;float:right;height:auto}#wpadminbar #distributor-push-wrapper .added-connection{background-color:#555;margin-bottom:.5em;cursor:normal;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection{cursor:pointer;top:1px;display:inline-block;float:right;font-size:20px;line-height:19px;vertical-align:middle;margin-left:6px;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection:after{content:\"\\f335\";font-family:dashicons}#wpadminbar #distributor-push-wrapper header,#wpadminbar #distributor-push-wrapper p{margin:0 0 1em!important;padding:0}#wpadminbar #distributor-push-wrapper .as-draft{margin-left:.5em;height:30px;line-height:28px;padding:2px 12px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box}#wpadminbar #distributor-push-wrapper .action-wrapper.loading .syndicate-button:after{content:\" \";vertical-align:middle;border-radius:50%;width:6px;margin-left:8px;height:6px;display:inline-block;font-size:9px;text-indent:-9999em;border-top:3px solid #cfcfcf;border-right:3px solid #cfcfcf;border-bottom:3px solid #cfcfcf;border-left:3px solid #00aef2;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:a 1.1s infinite linear;animation:a 1.1s infinite linear;position:relative;top:-1px;-webkit-box-sizing:content-box;box-sizing:content-box;-webkit-box-sizing:initial;box-sizing:initial}#wpadminbar #distributor-push-wrapper .messages{margin-top:1em;-webkit-box-sizing:border-box;box-sizing:border-box}@media (min-width:480px){#wpadminbar #distributor-push-wrapper .messages{width:40%;float:right;clear:right;padding-left:3em}}#wpadminbar #distributor-push-wrapper .messages *{display:none}#wpadminbar #distributor-push-wrapper.message-error .messages .dt-error,#wpadminbar #distributor-push-wrapper.message-success .messages .dt-success{display:block}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}"],"file":"push.min.css"} \ No newline at end of file +{"version":3,"names":[],"mappings":"","sources":["push.min.css"],"sourcesContent":["#distributor-push-wrapper{display:none}#wpadminbar #distributor-push-wrapper{display:none;font-size:13px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;top:32px;left:0;right:0;padding:2em 1em;height:auto;background-color:#32373c;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#eee;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;z-index:9999;-webkit-box-shadow:0 2px 1px 0 #000;box-shadow:0 2px 1px 0 #000;line-height:1.5}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{padding:2em 0}}#wpadminbar #distributor-push-wrapper *{line-height:1.5}.distributor-show #wp-admin-bar-distributor #distributor-push-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex}#wpadminbar #distributor-push-wrapper .inner{width:100%;max-width:768px;margin:0 auto}#wpadminbar #distributor-push-wrapper .new-connections-list{overflow:auto;border:1px solid #555;max-height:125px}#wpadminbar #distributor-push-wrapper .selected-connections-list{margin-bottom:1em}#wpadminbar #distributor-push-wrapper .connections-selected{margin-top:2em;position:relative}#wpadminbar #distributor-push-wrapper .connections-selected .no-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected.empty{opacity:.5}#wpadminbar #distributor-push-wrapper .connections-selected.empty .no-selected{display:block}#wpadminbar #distributor-push-wrapper .connections-selected.empty .with-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected label{color:inherit}#wpadminbar #distributor-push-wrapper .connections-selected input[type=checkbox]{vertical-align:middle;margin-right:2px}#wpadminbar #distributor-push-wrapper .connections-selected.empty:after{content:\" \";position:absolute;top:0;left:0;right:0;bottom:0;background-color:transparent}#wpadminbar #distributor-push-wrapper .syndicated-notice a{display:inline-block;padding:0;margin:0}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{position:fixed}#wpadminbar #distributor-push-wrapper .connections-selector{width:60%;position:relative;float:left;padding-right:0;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}#wpadminbar #distributor-push-wrapper .connections-selector div{width:100%}#wpadminbar #distributor-push-wrapper .connections-selected{width:40%;float:right;margin-top:0;padding-left:3em;-webkit-box-sizing:border-box;box-sizing:border-box}}#wpadminbar #distributor-push-wrapper .no-connections-notice,#wpadminbar #distributor-push-wrapper .syndicated-notice{text-align:center;margin:0}#wpadminbar #distributor-push-wrapper .no-connections-notice a,#wpadminbar #distributor-push-wrapper .syndicated-notice a{color:inherit;text-decoration:underline}#wpadminbar #distributor-push-wrapper input[type=checkbox]{height:16px!important}#wpadminbar #distributor-push-wrapper input[type=text]{font-size:inherit;padding:.5278em;width:100%;background-color:#32373c;border:2px solid #555;color:#eee;margin-bottom:.5em}#wpadminbar #distributor-push-wrapper input[type=text]::-webkit-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:-ms-input-placeholder,#wpadminbar #distributor-push-wrapper input[type=text]::-ms-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]::placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:focus{color:#eee;background-color:#32373c;border:2px solid #555}#wpadminbar #distributor-push-wrapper button{background:#0085ba;border-color:#0073aa #006799 #006799;border-width:1px;border-style:solid;-webkit-box-shadow:0 1px 0 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799;height:30px;line-height:28px;padding:0 12px 2px;border-radius:3px;text-transform:none;font-size:13px;vertical-align:top;font-weight:400;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}#wpadminbar #distributor-push-wrapper button:focus,#wpadminbar #distributor-push-wrapper button:hover{background-color:#0085ba;outline:none}#wpadminbar #distributor-push-wrapper .new-connections-list>div:nth-child(odd){background-color:#23282d}#wpadminbar #distributor-push-wrapper .add-connection,#wpadminbar #distributor-push-wrapper .added-connection{display:block;width:100%;padding:.5em;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:pointer}#wpadminbar #distributor-push-wrapper .new-connections-list .add-connection.added{background-color:#3a4045}#wpadminbar #distributor-push-wrapper .add-connection.syndicated{cursor:default}#wpadminbar #distributor-push-wrapper .add-connection.syndicated span{color:#555}#wpadminbar #distributor-push-wrapper .add-connection.syndicated a{color:inherit;text-decoration:underline;float:right;height:auto}#wpadminbar #distributor-push-wrapper .added-connection{background-color:#555;margin-bottom:.5em;cursor:normal;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection{cursor:pointer;top:1px;display:inline-block;float:right;font-size:20px;line-height:19px;vertical-align:middle;margin-left:6px;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection:after{content:\"\\f335\";font-family:dashicons}#wpadminbar #distributor-push-wrapper header,#wpadminbar #distributor-push-wrapper p{margin:0 0 1em!important;padding:0}#wpadminbar #distributor-push-wrapper .as-draft{margin-left:.5em;height:30px;line-height:28px;padding:2px 12px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box}#wpadminbar #distributor-push-wrapper .action-wrapper.loading .syndicate-button:after{content:\" \";vertical-align:middle;border-radius:50%;width:6px;margin-left:8px;height:6px;display:inline-block;font-size:9px;text-indent:-9999em;border-top:3px solid #cfcfcf;border-right:3px solid #cfcfcf;border-bottom:3px solid #cfcfcf;border-left:3px solid #00aef2;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:a 1.1s infinite linear;animation:a 1.1s infinite linear;position:relative;top:-1px;-webkit-box-sizing:content-box;box-sizing:content-box;-webkit-box-sizing:initial;box-sizing:initial}#wpadminbar #distributor-push-wrapper .messages{margin-top:1em;-webkit-box-sizing:border-box;box-sizing:border-box}@media (min-width:480px){#wpadminbar #distributor-push-wrapper .messages{width:40%;float:right;clear:right;padding-left:3em}}#wpadminbar #distributor-push-wrapper .messages *{display:none}#wpadminbar #distributor-push-wrapper.message-error .messages .dt-error,#wpadminbar #distributor-push-wrapper.message-success .messages .dt-success{display:block}#distributor-push-wrapper .loader-item{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;overflow:hidden}#distributor-push-wrapper.message-error .loader-item{display:none}@media (min-width:480px){#wpadminbar #distributor-push-wrapper .loader-messages{width:100%;float:none;padding-left:0}}#distributor-push-wrapper .loader-item,#distributor-push-wrapper .loader-item *,#distributor-push-wrapper .loader-item :after,#distributor-push-wrapper .loader-item :before{-webkit-box-sizing:border-box;box-sizing:border-box}#distributor-push-wrapper .loader-item:before{content:\" \";position:absolute;top:0;right:0;bottom:0;left:50%;z-index:1;width:349%;margin-left:-250%;-webkit-animation:b .8s linear infinite;animation:b .8s linear infinite;background:-webkit-gradient(linear,left top,right top,color-stop(46%,hsla(0,0%,100%,0)),color-stop(50%,hsla(0,0%,100%,.35)),color-stop(54%,hsla(0,0%,100%,0))) 50% 50%;background:linear-gradient(90deg,hsla(0,0%,100%,0) 46%,hsla(0,0%,100%,.35) 50%,hsla(0,0%,100%,0) 54%) 50% 50%}#distributor-push-wrapper .loader-item>*{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-flow:column;flex-flow:column}#distributor-push-wrapper .loader-row{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}#distributor-push-wrapper .loader-row.border{border:1px solid #555}#distributor-push-wrapper .loader-row div{height:15px}#distributor-push-wrapper .loader-row .big,#distributor-push-wrapper .loader-row.big div{height:30px}#distributor-push-wrapper .loader-row .odd{background-color:#23282d}#distributor-push-wrapper .loader-row .bottom{margin-bottom:15px}#distributor-push-wrapper .loader-col-4{-webkit-box-flex:0;-ms-flex:0 0 30%;flex:0 0 30%;padding-left:3em}#distributor-push-wrapper .loader-col-8{-webkit-box-flex:0;-ms-flex:0 0 60%;flex:0 0 60%}#distributor-push-wrapper .loader-col-12{-webkit-box-flex:0;-ms-flex:0 0 100%;flex:0 0 100%}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@-webkit-keyframes b{0%{-webkit-transform:translate3d(-30%,0,0);transform:translate3d(-30%,0,0)}to{-webkit-transform:translate3d(30%,0,0);transform:translate3d(30%,0,0)}}@keyframes b{0%{-webkit-transform:translate3d(-30%,0,0);transform:translate3d(-30%,0,0)}to{-webkit-transform:translate3d(30%,0,0);transform:translate3d(30%,0,0)}}"],"file":"push.min.css"} \ No newline at end of file diff --git a/dist/js/admin-distributed-post.min.js.map b/dist/js/admin-distributed-post.min.js.map index 2637423fe..3deeff83c 100644 --- a/dist/js/admin-distributed-post.min.js.map +++ b/dist/js/admin-distributed-post.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///admin-distributed-post.min.js","webpack:///webpack/bootstrap fff10cbf8520b51427a4","webpack:///external \"jQuery\"","webpack:///./assets/js/admin-distributed-post.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","0","jQuery","5","_jquery","_jquery2","obj","default","openLinks","document","querySelectorAll","helpLink","getElementById","distributorTab","querySelector","length","on","click"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMMC,EACA,SAAUvB,EAAQD,GEpExBC,EAAAD,QAAAyB,QF0EMC,EACA,SAAUzB,EAAQD,EAASH,GAEjC,YGvEA,KAAM,GANN8B,GAAA9B,EAAA,GHkFI+B,EAEJ,SAAgCC,GAAO,MAAOA,IAAOA,EAAIZ,WAAaY,GAAQC,QAASD,IAFjDF,GGhFhCI,EAAiBC,SAASC,iBAAkB,0BAC5CC,EAAiBF,SAASG,eAAgB,wBAC1CC,EAAiBJ,SAASK,cAAe,2BAErCnC,EAAI,EAAGA,EAAI6B,EAAUO,OAAQpC,KACtC,EAAA0B,EAAAE,SAAQC,EAAU7B,IAAKqC,GAAI,QAAS,WACnCL,EAASM,QACTJ,EAAeI","file":"admin-distributed-post.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 5);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 0:\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n\n/***/ 5:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar openLinks = document.querySelectorAll('.open-distributor-help');\nvar helpLink = document.getElementById('contextual-help-link');\nvar distributorTab = document.querySelector('#tab-link-distributer a');\n\nfor (var i = 0; i < openLinks.length; i++) {\n\t(0, _jquery2.default)(openLinks[i]).on('click', function () {\n\t\thelpLink.click();\n\t\tdistributorTab.click();\n\t});\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// admin-distributed-post.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fff10cbf8520b51427a4","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","import jQuery from 'jquery';\n\nconst openLinks = document.querySelectorAll( '.open-distributor-help' );\nconst helpLink = document.getElementById( 'contextual-help-link' );\nconst distributorTab = document.querySelector( '#tab-link-distributer a' );\n\nfor ( let i = 0; i < openLinks.length; i++ ) {\n\tjQuery( openLinks[i] ).on( 'click', () => {\n\t\thelpLink.click();\n\t\tdistributorTab.click();\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-distributed-post.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///admin-distributed-post.min.js","webpack:///webpack/bootstrap dc0891300b56d8a91118","webpack:///external \"jQuery\"","webpack:///./assets/js/admin-distributed-post.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","0","jQuery","5","_jquery","_jquery2","obj","default","openLinks","document","querySelectorAll","helpLink","getElementById","distributorTab","querySelector","length","on","click"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMMC,EACA,SAAUvB,EAAQD,GEpExBC,EAAAD,QAAAyB,QF0EMC,EACA,SAAUzB,EAAQD,EAASH,GAEjC,YGvEA,KAAM,GANN8B,GAAA9B,EAAA,GHkFI+B,EAEJ,SAAgCC,GAAO,MAAOA,IAAOA,EAAIZ,WAAaY,GAAQC,QAASD,IAFjDF,GGhFhCI,EAAiBC,SAASC,iBAAkB,0BAC5CC,EAAiBF,SAASG,eAAgB,wBAC1CC,EAAiBJ,SAASK,cAAe,2BAErCnC,EAAI,EAAGA,EAAI6B,EAAUO,OAAQpC,KACtC,EAAA0B,EAAAE,SAAQC,EAAU7B,IAAKqC,GAAI,QAAS,WACnCL,EAASM,QACTJ,EAAeI","file":"admin-distributed-post.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 5);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 0:\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n\n/***/ 5:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar openLinks = document.querySelectorAll('.open-distributor-help');\nvar helpLink = document.getElementById('contextual-help-link');\nvar distributorTab = document.querySelector('#tab-link-distributer a');\n\nfor (var i = 0; i < openLinks.length; i++) {\n\t(0, _jquery2.default)(openLinks[i]).on('click', function () {\n\t\thelpLink.click();\n\t\tdistributorTab.click();\n\t});\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// admin-distributed-post.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap dc0891300b56d8a91118","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","import jQuery from 'jquery';\n\nconst openLinks = document.querySelectorAll( '.open-distributor-help' );\nconst helpLink = document.getElementById( 'contextual-help-link' );\nconst distributorTab = document.querySelector( '#tab-link-distributer a' );\n\nfor ( let i = 0; i < openLinks.length; i++ ) {\n\tjQuery( openLinks[i] ).on( 'click', () => {\n\t\thelpLink.click();\n\t\tdistributorTab.click();\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-distributed-post.js"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/js/admin-external-connection.min.js.map b/dist/js/admin-external-connection.min.js.map index af1074d76..3b630ee90 100644 --- a/dist/js/admin-external-connection.min.js.map +++ b/dist/js/admin-external-connection.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///admin-external-connection.min.js","webpack:///webpack/bootstrap fff10cbf8520b51427a4","webpack:///external \"jQuery\"","webpack:///external \"window\"","webpack:///external \"_\"","webpack:///./assets/js/admin-external-connection.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","window","_","_interopRequireDefault","obj","default","checkConnections","$apiVerify","abort","externalConnectionUrlField","value","endpointErrors","innerText","endpointResult","removeAttribute","setAttribute","_window","dt","endpoint_checking_message","auth","_underscores2","each","authFields","authField","disabled","key","getAttribute","postId","postIdField","_jquery2","ajax","url","method","data","nonce","action","type","externalConnectionTypeField","endpointId","done","response","success","errors","no_external_connection","endpoint_suggestion","suggestion","document","createElement","classList","add","appendChild","bad_connection","no_distributor","can_post","length","limited_connection","warnings","bad_auth","push","no_push","pull_limited","forEach","warning","warningNode","append","good_connection","complete","remove","_jquery","_underscores","getElementsByClassName","externalConnectionMetaBox","getElementById","rolesAllowed","titleField","querySelector","setTimeout","on","event","currentTarget","trigger","debounce","replace","focus","blur","passwordField","usernameField","changePassword","style","display","preventDefault","cancel","change","target","contains","checked","alert","roles_warning","$hideUntilAuthed","$authCredentials","$clientSecret","$clientId","hideItemsRequiringAuth","hide","validateField","$field","val","addClass","removeClass","slug","show","createConnectionButton","validateClientSecret","validateClientId","changeCredentials","$authenticationDetailsWrapper","beginAuthorize","$titleEl","title","id","admin_url","history","pushState"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMM,SAAUtB,EAAQD,GEnExBC,EAAAD,QAAAwB,QFyEM,SAAUvB,EAAQD,GGzExBC,EAAAD,QAAAyB,QH+EM,SAAUxB,EAAQD,GI/ExBC,EAAAD,QAAA0B,GJqFM,SAAUzB,EAAQD,EAASH,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AAAxB,SAAQyC,SAAS0B,eAAgB,YAAckC,SAEjDnE,KAAM,SAAEC,GACX,GAAKA,EAASC,SAAWD,EAASP,KAAKsF,GAAK,CAG3C,GAAMxF,GAAMf,EAAAC,GAAGuG,UAAY,iBAAmBhF,EAASP,KAAKsF,GAAM,cAClEE,SAAQC,aAAe,0BAA2B3F,IAGlD,EAAAF,EAAAxB,SAAQyC,SAAS0B,eAAgB,oBAAsBkC,IAAK3E,IAC5D,EAAAF,EAAAxB,SAAQyC,SAAS0B,eAAgB,uBAAyBkC,IAAKlE,EAASP,KAAKsF,KAC7E,EAAA1F,EAAAxB,SAAQyC,SAAS0B,eAAgB,yBAA2BkC,IAAK,YAGjE,EAAA7E,EAAAxB,SAAQ,uCAAwCkG,OAChDY,EAA8BL,UAI5B5C,SAAU,YAGb,EAAArC,EAAAxB,SAAQ+G,GAAiBR,YAAa","file":"admin-external-connection.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 3);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = _;\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nvar _underscores = __webpack_require__(2);\n\nvar _underscores2 = _interopRequireDefault(_underscores);\n\nvar _window = __webpack_require__(1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar externalConnectionUrlField = document.getElementsByClassName('external-connection-url-field')[0];\nvar externalConnectionMetaBox = document.getElementById('dt_external_connection_details');\nvar externalConnectionTypeField = document.getElementsByClassName('external-connection-type-field')[0];\nvar authFields = document.getElementsByClassName('auth-field');\nvar rolesAllowed = document.getElementsByClassName('dt-roles-allowed');\nvar titleField = document.getElementById('title');\nvar endpointResult = document.querySelector('.endpoint-result');\nvar endpointErrors = document.querySelector('.endpoint-errors');\nvar postIdField = document.getElementById('post_ID');\nvar $apiVerify = false;\n\n/**\n * Check the external connection.\n */\nfunction checkConnections() {\n\tif (false !== $apiVerify) {\n\t\t$apiVerify.abort();\n\t}\n\n\tif ('' === externalConnectionUrlField.value) {\n\t\tendpointErrors.innerText = '';\n\t\tendpointResult.innerText = '';\n\n\t\tendpointResult.removeAttribute('data-endpoint-state');\n\t\treturn;\n\t}\n\n\tendpointResult.setAttribute('data-endpoint-state', 'loading');\n\tendpointResult.innerText = _window.dt.endpoint_checking_message;\n\n\tendpointErrors.innerText = '';\n\n\tvar auth = {};\n\n\t_underscores2.default.each(authFields, function (authField) {\n\t\tif (authField.disabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar key = authField.getAttribute('data-auth-field');\n\n\t\tif (key) {\n\t\t\tauth[key] = authField.value;\n\t\t}\n\t});\n\n\tvar postId = 0;\n\tif (postIdField && postIdField.value) {\n\t\tpostId = postIdField.value;\n\t}\n\n\t$apiVerify = _jquery2.default.ajax({\n\t\turl: _window.ajaxurl,\n\t\tmethod: 'post',\n\t\tdata: {\n\t\t\tnonce: _window.dt.nonce,\n\t\t\taction: 'dt_verify_external_connection',\n\t\t\tauth: auth,\n\t\t\turl: externalConnectionUrlField.value,\n\t\t\ttype: externalConnectionTypeField.value,\n\t\t\tendpointId: postId\n\t\t}\n\t}).done(function (response) {\n\t\tif (!response.success) {\n\t\t\tendpointResult.setAttribute('data-endpoint-state', 'error');\n\t\t} else {\n\t\t\tif (response.data.errors.no_external_connection) {\n\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'error');\n\n\t\t\t\tif (response.data.endpoint_suggestion) {\n\t\t\t\t\tendpointResult.innerText = _window.dt.endpoint_suggestion + ' ';\n\n\t\t\t\t\tvar suggestion = document.createElement('a');\n\t\t\t\t\tsuggestion.classList.add('suggest');\n\t\t\t\t\tsuggestion.innerText = response.data.endpoint_suggestion;\n\n\t\t\t\t\tendpointResult.appendChild(suggestion);\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.innerText = _window.dt.bad_connection;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (response.data.errors.no_distributor || !response.data.can_post.length) {\n\t\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'warning');\n\t\t\t\t\tendpointResult.innerText = _window.dt.limited_connection;\n\n\t\t\t\t\tvar warnings = [];\n\n\t\t\t\t\tif (response.data.errors.no_distributor) {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + _window.dt.no_distributor;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + _window.dt.bad_auth;\n\t\t\t\t\t}\n\n\t\t\t\t\twarnings.push(_window.dt.no_push);\n\t\t\t\t\twarnings.push(_window.dt.pull_limited);\n\n\t\t\t\t\twarnings.forEach(function (warning) {\n\t\t\t\t\t\tvar warningNode = document.createElement('li');\n\t\t\t\t\t\twarningNode.innerText = warning;\n\n\t\t\t\t\t\tendpointErrors.append(warningNode);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'valid');\n\t\t\t\t\tendpointResult.innerText = _window.dt.good_connection;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}).complete(function () {\n\t\tendpointResult.classList.remove('loading');\n\t});\n}\n\nsetTimeout(function () {\n\tcheckConnections();\n}, 300);\n\n(0, _jquery2.default)(externalConnectionMetaBox).on('click', '.suggest', function (event) {\n\texternalConnectionUrlField.value = event.currentTarget.innerText;\n\t(0, _jquery2.default)(externalConnectionUrlField).trigger('input');\n});\n\n(0, _jquery2.default)(externalConnectionMetaBox).on('keyup input', '.auth-field, .external-connection-url-field', _underscores2.default.debounce(checkConnections, 250));\n\n(0, _jquery2.default)(externalConnectionUrlField).on('blur', function (event) {\n\tif ('' === titleField.value && '' !== event.currentTarget.value) {\n\t\ttitleField.value = event.currentTarget.value.replace(/https?:\\/\\//i, '');\n\t\ttitleField.focus();\n\t\ttitleField.blur();\n\t}\n});\n/**\n * JS for basic auth\n *\n * @todo separate\n */\nvar passwordField = document.getElementById('dt_password');\nvar usernameField = document.getElementById('dt_username');\nvar changePassword = document.querySelector('.change-password');\n\n(0, _jquery2.default)(usernameField).on('keyup change', _underscores2.default.debounce(function () {\n\tif (changePassword) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tchangePassword.style.display = 'none';\n\t}\n}, 250));\n\n(0, _jquery2.default)(changePassword).on('click', function (event) {\n\tevent.preventDefault();\n\n\tif (passwordField.disabled) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tevent.currentTarget.innerText = _window.dt.cancel;\n\t} else {\n\t\tpasswordField.disabled = true;\n\t\tpasswordField.value = 'sdfdsfsdfdsfdsfsd'; // filler password\n\t\tevent.currentTarget.innerText = _window.dt.change;\n\t}\n\n\tcheckConnections();\n});\n\n(0, _jquery2.default)(rolesAllowed).on('click', '.dt-role-checkbox', function (event) {\n\tif (!event.target.classList.contains('dt-role-checkbox')) {\n\t\treturn;\n\t}\n\n\tif (!event.target.checked) {\n\t\treturn;\n\t}\n\n\tif ('administrator' !== event.target.value && 'editor' !== event.target.value) {\n\t\talert(_window.dt.roles_warning); // eslint-disable-line no-alert\n\t}\n});\n\n/**\n * Code for WordPress.com Oauth2 Authentication.\n *\n * @todo separate out code.\n */\n\n/**\n * If the client id and secret are unavailable, hide all '.hide-until-authed' areas.\n *\n * For Oauth authentication, simplify the interface by hiding certain elements until the user has\n * completed the authorization process.\n *\n * Creates a cleaner flow for authorization by separating the authorization steps.\n */\nvar $hideUntilAuthed = (0, _jquery2.default)('.hide-until-authed'),\n $authCredentials = (0, _jquery2.default)('.auth-credentials'),\n $clientSecret = (0, _jquery2.default)(document.getElementById('dt_client_secret')),\n $clientId = (0, _jquery2.default)(document.getElementById('dt_client_id')),\n hideItemsRequiringAuth = function hideItemsRequiringAuth() {\n\tvar oauthconnectionestablished = document.getElementsByClassName('oauth-connection-established');\n\tif (0 === oauthconnectionestablished.length) {\n\t\t$hideUntilAuthed.hide();\n\t}\n},\n\n\n/**\n * Validate a form field, ensuring it is non-empty. Add an error class if empty.\n *\n * @param {jQuery DomElement} $field The field to check.\n */\nvalidateField = function validateField($field, event) {\n\tif ('' === $field.val()) {\n\t\tevent.preventDefault();\n\t\t$field.addClass('error-required');\n\t\treturn false;\n\t} else {\n\t\t$field.removeClass('error-required');\n\t}\n\treturn true;\n};\n\n/**\n * When the External connection type drop-down is changed, show the corresponding authorization fields.\n */\n(0, _jquery2.default)(externalConnectionTypeField).on('change', function () {\n\tvar slug = externalConnectionTypeField.value;\n\n\t$authCredentials.hide();\n\t(0, _jquery2.default)('.auth-credentials.' + slug).show();\n\n\t// For WordPress.com Oauth authentication, hide fields until authentication is complete.\n\tif ('wpdotcom' === slug) {\n\t\thideItemsRequiringAuth();\n\t} else {\n\n\t\t// Otherwise, ensure all areas are showing.\n\t\t$hideUntilAuthed.show();\n\t}\n});\n\n// On load for WordPress.com Oauth authentication, hide fields until authentication is complete.\nif ('wpdotcom' === externalConnectionTypeField.value) {\n\thideItemsRequiringAuth();\n}\n\n// When authorization is initiated, ensure fields are non-empty.\nvar createConnectionButton = document.getElementById('create-oauth-connection');\nif (createConnectionButton) {\n\t(0, _jquery2.default)(createConnectionButton).on('click', function (event) {\n\t\tvar validateClientSecret = validateField($clientSecret, event),\n\t\t validateClientId = validateField($clientId, event);\n\t\tif (!validateClientSecret || !validateClientId) {\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t}\n\t});\n}\n\n// Handle the changeCredentials link.\nvar changeCredentials = document.getElementById('oauth-authentication-change-credentials'),\n $authenticationDetailsWrapper = (0, _jquery2.default)('.oauth-authentication-details-wrapper');\n\nif (changeCredentials) {\n\n\t(0, _jquery2.default)(changeCredentials).on('click', function () {\n\n\t\t// Show the credentials fields.\n\t\t$authenticationDetailsWrapper.show();\n\n\t\t// Clear the secret field.\n\t\t$clientSecret.val('');\n\n\t\t// Remove the authorized message.\n\t\t(0, _jquery2.default)('.oauth-connection-established').remove();\n\n\t\t// Hide the remaining fields that only show after authorization is complete.\n\t\thideItemsRequiringAuth();\n\t});\n}\n\n// Handle the Authorize Connection button.\nvar beginAuthorize = document.getElementById('begin-authorization');\nif (beginAuthorize) {\n\n\t// Handle click to the wpdotcom begin-authorization button.\n\t(0, _jquery2.default)(beginAuthorize).on('click', function (event) {\n\t\tvar $titleEl = (0, _jquery2.default)(titleField),\n\t\t title = $titleEl.val();\n\n\t\t// Ensure the connection title is not blank.\n\t\tif (validateField($titleEl, event)) {\n\n\t\t\t// Disable the button during the ajax request.\n\t\t\t(0, _jquery2.default)(beginAuthorize).addClass('disabled');\n\n\t\t\t// Remove any error highlighting.\n\t\t\t$titleEl.removeClass('error-required');\n\n\t\t\t// Make an ajax request to save the connection and retrieve the resulting post id.\n\t\t\t_jquery2.default.ajax({\n\t\t\t\turl: _window.ajaxurl,\n\t\t\t\tmethod: 'post',\n\t\t\t\tdata: {\n\t\t\t\t\tnonce: _window.dt.nonce,\n\t\t\t\t\taction: 'dt_begin_authorization',\n\t\t\t\t\ttitle: title,\n\t\t\t\t\tid: (0, _jquery2.default)(document.getElementById('post_ID')).val()\n\t\t\t\t}\n\t\t\t}).done(function (response) {\n\t\t\t\tif (response.success && response.data.id) {\n\n\t\t\t\t\t// The post has been saved, update the url in case the user refreshes.\n\t\t\t\t\tvar url = _window.dt.admin_url + 'post.php?post=' + response.data.id + '&action=edit';\n\t\t\t\t\thistory.pushState({}, 'Oauth Authorize Details', url);\n\n\t\t\t\t\t// Update the form field for dt_redirect_uri and post id.\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('dt_redirect_uri')).val(url);\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('dt_created_post_id')).val(response.data.id);\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('original_post_status')).val('publish');\n\n\t\t\t\t\t// Hide the first step and show the authentication details.\n\t\t\t\t\t(0, _jquery2.default)('.oauth-begin-authentication-wrapper').hide();\n\t\t\t\t\t$authenticationDetailsWrapper.show();\n\t\t\t\t} else {\n\t\t\t\t\t// @todo handle errors.\n\t\t\t\t}\n\t\t\t}).complete(function () {\n\n\t\t\t\t// Ensure the\n\t\t\t\t(0, _jquery2.default)(beginAuthorize).removeClass('disabled');\n\t\t\t});\n\t\t}\n\t});\n}\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// admin-external-connection.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fff10cbf8520b51427a4","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","module.exports = _;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"_\"\n// module id = 2\n// module chunks = 0 1","import jQuery from 'jquery';\nimport _ from 'underscores';\nimport { dt, ajaxurl } from 'window';\n\nconst externalConnectionUrlField = document.getElementsByClassName( 'external-connection-url-field' )[0];\nconst externalConnectionMetaBox = document.getElementById( 'dt_external_connection_details' );\nconst externalConnectionTypeField = document.getElementsByClassName( 'external-connection-type-field' )[0];\nconst authFields = document.getElementsByClassName( 'auth-field' );\nconst rolesAllowed = document.getElementsByClassName( 'dt-roles-allowed' );\nconst titleField = document.getElementById( 'title' );\nconst endpointResult = document.querySelector( '.endpoint-result' );\nconst endpointErrors = document.querySelector( '.endpoint-errors' );\nconst postIdField = document.getElementById( 'post_ID' );\nlet $apiVerify = false;\n\n/**\n * Check the external connection.\n */\nfunction checkConnections() {\n\tif ( false !== $apiVerify ) {\n\t\t$apiVerify.abort();\n\t}\n\n\tif ( '' === externalConnectionUrlField.value ) {\n\t\tendpointErrors.innerText = '';\n\t\tendpointResult.innerText = '';\n\n\t\tendpointResult.removeAttribute( 'data-endpoint-state' );\n\t\treturn;\n\t}\n\n\tendpointResult.setAttribute( 'data-endpoint-state', 'loading' );\n\tendpointResult.innerText = dt.endpoint_checking_message;\n\n\tendpointErrors.innerText = '';\n\n\tconst auth = {};\n\n\t_.each( authFields, ( authField ) => {\n\t\tif ( authField.disabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar key = authField.getAttribute( 'data-auth-field' );\n\n\t\tif ( key ) {\n\t\t\tauth[key] = authField.value;\n\t\t}\n\t} );\n\n\tlet postId = 0;\n\tif ( postIdField && postIdField.value ) {\n\t\tpostId = postIdField.value;\n\t}\n\n\t$apiVerify = jQuery.ajax( {\n\t\turl: ajaxurl,\n\t\tmethod: 'post',\n\t\tdata: {\n\t\t\tnonce: dt.nonce,\n\t\t\taction: 'dt_verify_external_connection',\n\t\t\tauth: auth,\n\t\t\turl: externalConnectionUrlField.value,\n\t\t\ttype: externalConnectionTypeField.value,\n\t\t\tendpointId: postId\n\t\t}\n\t} ).done( ( response ) => {\n\t\tif ( ! response.success ) {\n\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'error' );\n\t\t} else {\n\t\t\tif ( response.data.errors.no_external_connection ) {\n\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'error' );\n\n\t\t\t\tif ( response.data.endpoint_suggestion ) {\n\t\t\t\t\tendpointResult.innerText = dt.endpoint_suggestion + ' ';\n\n\t\t\t\t\tconst suggestion = document.createElement( 'a' );\n\t\t\t\t\tsuggestion.classList.add( 'suggest' );\n\t\t\t\t\tsuggestion.innerText = response.data.endpoint_suggestion;\n\n\t\t\t\t\tendpointResult.appendChild( suggestion );\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.innerText = dt.bad_connection;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( response.data.errors.no_distributor || ! response.data.can_post.length ) {\n\t\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'warning' );\n\t\t\t\t\tendpointResult.innerText = dt.limited_connection;\n\n\t\t\t\t\tconst warnings = [];\n\n\t\t\t\t\tif ( response.data.errors.no_distributor ) {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + dt.no_distributor;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + dt.bad_auth;\n\t\t\t\t\t}\n\n\t\t\t\t\twarnings.push( dt.no_push );\n\t\t\t\t\twarnings.push( dt.pull_limited );\n\n\t\t\t\t\twarnings.forEach( ( warning ) => {\n\t\t\t\t\t\tconst warningNode = document.createElement( 'li' );\n\t\t\t\t\t\twarningNode.innerText = warning;\n\n\t\t\t\t\t\tendpointErrors.append( warningNode );\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'valid' );\n\t\t\t\t\tendpointResult.innerText = dt.good_connection;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} ).complete( () => {\n\t\tendpointResult.classList.remove( 'loading' );\n\t} );\n}\n\nsetTimeout( () => {\n\tcheckConnections();\n}, 300 );\n\njQuery( externalConnectionMetaBox ).on( 'click', '.suggest', ( event ) => {\n\texternalConnectionUrlField.value = event.currentTarget.innerText;\n\tjQuery( externalConnectionUrlField ).trigger( 'input' );\n} );\n\njQuery( externalConnectionMetaBox ).on( 'keyup input', '.auth-field, .external-connection-url-field', _.debounce( checkConnections, 250 ) );\n\njQuery( externalConnectionUrlField ).on( 'blur', ( event ) => {\n\tif ( '' === titleField.value && '' !== event.currentTarget.value ) {\n\t\ttitleField.value = event.currentTarget.value.replace( /https?:\\/\\//i, '' );\n\t\ttitleField.focus();\n\t\ttitleField.blur();\n\t}\n} );\n/**\n * JS for basic auth\n *\n * @todo separate\n */\nconst passwordField = document.getElementById( 'dt_password' );\nconst usernameField = document.getElementById( 'dt_username' );\nconst changePassword = document.querySelector( '.change-password' );\n\njQuery( usernameField ).on( 'keyup change', _.debounce( () => {\n\tif ( changePassword ) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tchangePassword.style.display = 'none';\n\t}\n}, 250 ) );\n\njQuery( changePassword ).on( 'click', ( event ) => {\n\tevent.preventDefault();\n\n\tif ( passwordField.disabled ) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tevent.currentTarget.innerText = dt.cancel;\n\t} else {\n\t\tpasswordField.disabled = true;\n\t\tpasswordField.value = 'sdfdsfsdfdsfdsfsd'; // filler password\n\t\tevent.currentTarget.innerText = dt.change;\n\t}\n\n\tcheckConnections();\n} );\n\njQuery( rolesAllowed ).on( 'click', '.dt-role-checkbox', ( event ) => {\n\tif ( ! event.target.classList.contains( 'dt-role-checkbox' ) ) {\n\t\treturn;\n\t}\n\n\tif ( ! event.target.checked ) {\n\t\treturn;\n\t}\n\n\tif ( 'administrator' !== event.target.value && 'editor' !== event.target.value ) {\n\t\talert( dt.roles_warning ); // eslint-disable-line no-alert\n\t}\n} );\n\n/**\n * Code for WordPress.com Oauth2 Authentication.\n *\n * @todo separate out code.\n */\n\n/**\n * If the client id and secret are unavailable, hide all '.hide-until-authed' areas.\n *\n * For Oauth authentication, simplify the interface by hiding certain elements until the user has\n * completed the authorization process.\n *\n * Creates a cleaner flow for authorization by separating the authorization steps.\n */\nconst $hideUntilAuthed = jQuery( '.hide-until-authed' ),\n\t$authCredentials = jQuery( '.auth-credentials' ),\n\t$clientSecret = jQuery( document.getElementById( 'dt_client_secret' ) ),\n\t$clientId = jQuery( document.getElementById( 'dt_client_id' ) ),\n\thideItemsRequiringAuth = () => {\n\t\tconst oauthconnectionestablished = document.getElementsByClassName( 'oauth-connection-established' );\n\t\tif ( 0 === oauthconnectionestablished.length ) {\n\t\t\t$hideUntilAuthed.hide();\n\t\t}\n\t},\n\n\t/**\n\t * Validate a form field, ensuring it is non-empty. Add an error class if empty.\n\t *\n\t * @param {jQuery DomElement} $field The field to check.\n\t */\n\tvalidateField = ( $field, event ) => {\n\t\tif ( '' === $field.val() ) {\n\t\t\tevent.preventDefault();\n\t\t\t$field.addClass( 'error-required' );\n\t\t\treturn false;\n\t\t} else {\n\t\t\t$field.removeClass( 'error-required' );\n\t\t}\n\t\treturn true;\n\t};\n\n/**\n * When the External connection type drop-down is changed, show the corresponding authorization fields.\n */\njQuery( externalConnectionTypeField ).on( 'change', () => {\n\tconst slug = externalConnectionTypeField.value;\n\n\t$authCredentials.hide();\n\tjQuery( '.auth-credentials.' + slug ).show();\n\n\t// For WordPress.com Oauth authentication, hide fields until authentication is complete.\n\tif ( 'wpdotcom' === slug ) {\n\t\thideItemsRequiringAuth();\n\t} else {\n\n\t\t// Otherwise, ensure all areas are showing.\n\t\t$hideUntilAuthed.show();\n\t}\n} );\n\n\n// On load for WordPress.com Oauth authentication, hide fields until authentication is complete.\nif ( 'wpdotcom' === externalConnectionTypeField.value ) {\n\thideItemsRequiringAuth();\n}\n\n// When authorization is initiated, ensure fields are non-empty.\nconst createConnectionButton = document.getElementById( 'create-oauth-connection' );\nif ( createConnectionButton ) {\n\tjQuery( createConnectionButton ).on( 'click', ( event ) => {\n\t\tconst validateClientSecret = validateField( $clientSecret, event ),\n\t\t\tvalidateClientId = validateField( $clientId, event );\n\t\tif (\n\t\t\t! validateClientSecret ||\n\t\t\t! validateClientId\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t}\n\t} );\n}\n\n// Handle the changeCredentials link.\nconst changeCredentials = document.getElementById( 'oauth-authentication-change-credentials' ),\n\t$authenticationDetailsWrapper = jQuery( '.oauth-authentication-details-wrapper' );\n\nif ( changeCredentials ) {\n\n\tjQuery( changeCredentials ).on( 'click', function() {\n\n\t\t// Show the credentials fields.\n\t\t$authenticationDetailsWrapper.show();\n\n\t\t// Clear the secret field.\n\t\t$clientSecret.val( '' );\n\n\t\t// Remove the authorized message.\n\t\tjQuery( '.oauth-connection-established' ).remove();\n\n\t\t// Hide the remaining fields that only show after authorization is complete.\n\t\thideItemsRequiringAuth();\n\t} );\n}\n\n// Handle the Authorize Connection button.\nconst beginAuthorize = document.getElementById( 'begin-authorization' );\nif ( beginAuthorize ) {\n\n\t// Handle click to the wpdotcom begin-authorization button.\n\tjQuery( beginAuthorize ).on( 'click', ( event ) => {\n\t\tconst $titleEl = jQuery( titleField ),\n\t\t\ttitle = $titleEl.val();\n\n\t\t// Ensure the connection title is not blank.\n\t\tif ( validateField( $titleEl, event ) ) {\n\n\t\t\t// Disable the button during the ajax request.\n\t\t\tjQuery( beginAuthorize ).addClass( 'disabled' );\n\n\t\t\t// Remove any error highlighting.\n\t\t\t$titleEl.removeClass( 'error-required' );\n\n\t\t\t// Make an ajax request to save the connection and retrieve the resulting post id.\n\t\t\tjQuery.ajax( {\n\t\t\t\turl: ajaxurl,\n\t\t\t\tmethod: 'post',\n\t\t\t\tdata: {\n\t\t\t\t\tnonce: dt.nonce,\n\t\t\t\t\taction: 'dt_begin_authorization',\n\t\t\t\t\ttitle: title,\n\t\t\t\t\tid: jQuery( document.getElementById( 'post_ID' ) ).val()\n\t\t\t\t}\n\t\t\t} ).done( ( response ) => {\n\t\t\t\tif ( response.success && response.data.id ) {\n\n\t\t\t\t\t// The post has been saved, update the url in case the user refreshes.\n\t\t\t\t\tconst url = dt.admin_url + 'post.php?post=' + response.data.id + '&action=edit';\n\t\t\t\t\thistory.pushState( {}, 'Oauth Authorize Details', url );\n\n\t\t\t\t\t// Update the form field for dt_redirect_uri and post id.\n\t\t\t\t\tjQuery( document.getElementById( 'dt_redirect_uri' ) ).val( url );\n\t\t\t\t\tjQuery( document.getElementById( 'dt_created_post_id' ) ).val( response.data.id );\n\t\t\t\t\tjQuery( document.getElementById( 'original_post_status' ) ).val( 'publish' );\n\n\t\t\t\t\t// Hide the first step and show the authentication details.\n\t\t\t\t\tjQuery( '.oauth-begin-authentication-wrapper' ).hide();\n\t\t\t\t\t$authenticationDetailsWrapper.show();\n\t\t\t\t} else {\n\t\t\t\t\t// @todo handle errors.\n\t\t\t\t}\n\t\t\t} ).complete( () => {\n\n\t\t\t\t// Ensure the\n\t\t\t\tjQuery( beginAuthorize ).removeClass( 'disabled' );\n\t\t\t} );\n\t\t}\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-external-connection.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///admin-external-connection.min.js","webpack:///webpack/bootstrap dc0891300b56d8a91118","webpack:///external \"jQuery\"","webpack:///external \"window\"","webpack:///external \"_\"","webpack:///./assets/js/admin-external-connection.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","window","_","_interopRequireDefault","obj","default","checkConnections","$apiVerify","abort","externalConnectionUrlField","value","endpointErrors","innerText","endpointResult","removeAttribute","setAttribute","_window","dt","endpoint_checking_message","auth","_underscores2","each","authFields","authField","disabled","key","getAttribute","postId","postIdField","_jquery2","ajax","url","method","data","nonce","action","type","externalConnectionTypeField","endpointId","done","response","success","errors","no_external_connection","endpoint_suggestion","suggestion","document","createElement","classList","add","appendChild","bad_connection","no_distributor","can_post","length","limited_connection","warnings","bad_auth","push","no_push","pull_limited","forEach","warning","warningNode","append","good_connection","complete","remove","_jquery","_underscores","getElementsByClassName","externalConnectionMetaBox","getElementById","rolesAllowed","titleField","querySelector","setTimeout","on","event","currentTarget","trigger","debounce","replace","focus","blur","passwordField","usernameField","changePassword","style","display","preventDefault","cancel","change","target","contains","checked","alert","roles_warning","$hideUntilAuthed","$authCredentials","$clientSecret","$clientId","hideItemsRequiringAuth","hide","validateField","$field","val","addClass","removeClass","slug","show","createConnectionButton","validateClientSecret","validateClientId","changeCredentials","$authenticationDetailsWrapper","beginAuthorize","$titleEl","title","id","admin_url","history","pushState"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAG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.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 3);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = _;\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nvar _underscores = __webpack_require__(2);\n\nvar _underscores2 = _interopRequireDefault(_underscores);\n\nvar _window = __webpack_require__(1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar externalConnectionUrlField = document.getElementsByClassName('external-connection-url-field')[0];\nvar externalConnectionMetaBox = document.getElementById('dt_external_connection_details');\nvar externalConnectionTypeField = document.getElementsByClassName('external-connection-type-field')[0];\nvar authFields = document.getElementsByClassName('auth-field');\nvar rolesAllowed = document.getElementsByClassName('dt-roles-allowed');\nvar titleField = document.getElementById('title');\nvar endpointResult = document.querySelector('.endpoint-result');\nvar endpointErrors = document.querySelector('.endpoint-errors');\nvar postIdField = document.getElementById('post_ID');\nvar $apiVerify = false;\n\n/**\n * Check the external connection.\n */\nfunction checkConnections() {\n\tif (false !== $apiVerify) {\n\t\t$apiVerify.abort();\n\t}\n\n\tif ('' === externalConnectionUrlField.value) {\n\t\tendpointErrors.innerText = '';\n\t\tendpointResult.innerText = '';\n\n\t\tendpointResult.removeAttribute('data-endpoint-state');\n\t\treturn;\n\t}\n\n\tendpointResult.setAttribute('data-endpoint-state', 'loading');\n\tendpointResult.innerText = _window.dt.endpoint_checking_message;\n\n\tendpointErrors.innerText = '';\n\n\tvar auth = {};\n\n\t_underscores2.default.each(authFields, function (authField) {\n\t\tif (authField.disabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar key = authField.getAttribute('data-auth-field');\n\n\t\tif (key) {\n\t\t\tauth[key] = authField.value;\n\t\t}\n\t});\n\n\tvar postId = 0;\n\tif (postIdField && postIdField.value) {\n\t\tpostId = postIdField.value;\n\t}\n\n\t$apiVerify = _jquery2.default.ajax({\n\t\turl: _window.ajaxurl,\n\t\tmethod: 'post',\n\t\tdata: {\n\t\t\tnonce: _window.dt.nonce,\n\t\t\taction: 'dt_verify_external_connection',\n\t\t\tauth: auth,\n\t\t\turl: externalConnectionUrlField.value,\n\t\t\ttype: externalConnectionTypeField.value,\n\t\t\tendpointId: postId\n\t\t}\n\t}).done(function (response) {\n\t\tif (!response.success) {\n\t\t\tendpointResult.setAttribute('data-endpoint-state', 'error');\n\t\t} else {\n\t\t\tif (response.data.errors.no_external_connection) {\n\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'error');\n\n\t\t\t\tif (response.data.endpoint_suggestion) {\n\t\t\t\t\tendpointResult.innerText = _window.dt.endpoint_suggestion + ' ';\n\n\t\t\t\t\tvar suggestion = document.createElement('a');\n\t\t\t\t\tsuggestion.classList.add('suggest');\n\t\t\t\t\tsuggestion.innerText = response.data.endpoint_suggestion;\n\n\t\t\t\t\tendpointResult.appendChild(suggestion);\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.innerText = _window.dt.bad_connection;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (response.data.errors.no_distributor || !response.data.can_post.length) {\n\t\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'warning');\n\t\t\t\t\tendpointResult.innerText = _window.dt.limited_connection;\n\n\t\t\t\t\tvar warnings = [];\n\n\t\t\t\t\tif (response.data.errors.no_distributor) {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + _window.dt.no_distributor;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + _window.dt.bad_auth;\n\t\t\t\t\t}\n\n\t\t\t\t\twarnings.push(_window.dt.no_push);\n\t\t\t\t\twarnings.push(_window.dt.pull_limited);\n\n\t\t\t\t\twarnings.forEach(function (warning) {\n\t\t\t\t\t\tvar warningNode = document.createElement('li');\n\t\t\t\t\t\twarningNode.innerText = warning;\n\n\t\t\t\t\t\tendpointErrors.append(warningNode);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'valid');\n\t\t\t\t\tendpointResult.innerText = _window.dt.good_connection;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}).complete(function () {\n\t\tendpointResult.classList.remove('loading');\n\t});\n}\n\nsetTimeout(function () {\n\tcheckConnections();\n}, 300);\n\n(0, _jquery2.default)(externalConnectionMetaBox).on('click', '.suggest', function (event) {\n\texternalConnectionUrlField.value = event.currentTarget.innerText;\n\t(0, _jquery2.default)(externalConnectionUrlField).trigger('input');\n});\n\n(0, _jquery2.default)(externalConnectionMetaBox).on('keyup input', '.auth-field, .external-connection-url-field', _underscores2.default.debounce(checkConnections, 250));\n\n(0, _jquery2.default)(externalConnectionUrlField).on('blur', function (event) {\n\tif ('' === titleField.value && '' !== event.currentTarget.value) {\n\t\ttitleField.value = event.currentTarget.value.replace(/https?:\\/\\//i, '');\n\t\ttitleField.focus();\n\t\ttitleField.blur();\n\t}\n});\n/**\n * JS for basic auth\n *\n * @todo separate\n */\nvar passwordField = document.getElementById('dt_password');\nvar usernameField = document.getElementById('dt_username');\nvar changePassword = document.querySelector('.change-password');\n\n(0, _jquery2.default)(usernameField).on('keyup change', _underscores2.default.debounce(function () {\n\tif (changePassword) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tchangePassword.style.display = 'none';\n\t}\n}, 250));\n\n(0, _jquery2.default)(changePassword).on('click', function (event) {\n\tevent.preventDefault();\n\n\tif (passwordField.disabled) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tevent.currentTarget.innerText = _window.dt.cancel;\n\t} else {\n\t\tpasswordField.disabled = true;\n\t\tpasswordField.value = 'sdfdsfsdfdsfdsfsd'; // filler password\n\t\tevent.currentTarget.innerText = _window.dt.change;\n\t}\n\n\tcheckConnections();\n});\n\n(0, _jquery2.default)(rolesAllowed).on('click', '.dt-role-checkbox', function (event) {\n\tif (!event.target.classList.contains('dt-role-checkbox')) {\n\t\treturn;\n\t}\n\n\tif (!event.target.checked) {\n\t\treturn;\n\t}\n\n\tif ('administrator' !== event.target.value && 'editor' !== event.target.value) {\n\t\talert(_window.dt.roles_warning); // eslint-disable-line no-alert\n\t}\n});\n\n/**\n * Code for WordPress.com Oauth2 Authentication.\n *\n * @todo separate out code.\n */\n\n/**\n * If the client id and secret are unavailable, hide all '.hide-until-authed' areas.\n *\n * For Oauth authentication, simplify the interface by hiding certain elements until the user has\n * completed the authorization process.\n *\n * Creates a cleaner flow for authorization by separating the authorization steps.\n */\nvar $hideUntilAuthed = (0, _jquery2.default)('.hide-until-authed'),\n $authCredentials = (0, _jquery2.default)('.auth-credentials'),\n $clientSecret = (0, _jquery2.default)(document.getElementById('dt_client_secret')),\n $clientId = (0, _jquery2.default)(document.getElementById('dt_client_id')),\n hideItemsRequiringAuth = function hideItemsRequiringAuth() {\n\tvar oauthconnectionestablished = document.getElementsByClassName('oauth-connection-established');\n\tif (0 === oauthconnectionestablished.length) {\n\t\t$hideUntilAuthed.hide();\n\t}\n},\n\n\n/**\n * Validate a form field, ensuring it is non-empty. Add an error class if empty.\n *\n * @param {jQuery DomElement} $field The field to check.\n */\nvalidateField = function validateField($field, event) {\n\tif ('' === $field.val()) {\n\t\tevent.preventDefault();\n\t\t$field.addClass('error-required');\n\t\treturn false;\n\t} else {\n\t\t$field.removeClass('error-required');\n\t}\n\treturn true;\n};\n\n/**\n * When the External connection type drop-down is changed, show the corresponding authorization fields.\n */\n(0, _jquery2.default)(externalConnectionTypeField).on('change', function () {\n\tvar slug = externalConnectionTypeField.value;\n\n\t$authCredentials.hide();\n\t(0, _jquery2.default)('.auth-credentials.' + slug).show();\n\n\t// For WordPress.com Oauth authentication, hide fields until authentication is complete.\n\tif ('wpdotcom' === slug) {\n\t\thideItemsRequiringAuth();\n\t} else {\n\n\t\t// Otherwise, ensure all areas are showing.\n\t\t$hideUntilAuthed.show();\n\t}\n});\n\n// On load for WordPress.com Oauth authentication, hide fields until authentication is complete.\nif ('wpdotcom' === externalConnectionTypeField.value) {\n\thideItemsRequiringAuth();\n}\n\n// When authorization is initiated, ensure fields are non-empty.\nvar createConnectionButton = document.getElementById('create-oauth-connection');\nif (createConnectionButton) {\n\t(0, _jquery2.default)(createConnectionButton).on('click', function (event) {\n\t\tvar validateClientSecret = validateField($clientSecret, event),\n\t\t validateClientId = validateField($clientId, event);\n\t\tif (!validateClientSecret || !validateClientId) {\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t}\n\t});\n}\n\n// Handle the changeCredentials link.\nvar changeCredentials = document.getElementById('oauth-authentication-change-credentials'),\n $authenticationDetailsWrapper = (0, _jquery2.default)('.oauth-authentication-details-wrapper');\n\nif (changeCredentials) {\n\n\t(0, _jquery2.default)(changeCredentials).on('click', function () {\n\n\t\t// Show the credentials fields.\n\t\t$authenticationDetailsWrapper.show();\n\n\t\t// Clear the secret field.\n\t\t$clientSecret.val('');\n\n\t\t// Remove the authorized message.\n\t\t(0, _jquery2.default)('.oauth-connection-established').remove();\n\n\t\t// Hide the remaining fields that only show after authorization is complete.\n\t\thideItemsRequiringAuth();\n\t});\n}\n\n// Handle the Authorize Connection button.\nvar beginAuthorize = document.getElementById('begin-authorization');\nif (beginAuthorize) {\n\n\t// Handle click to the wpdotcom begin-authorization button.\n\t(0, _jquery2.default)(beginAuthorize).on('click', function (event) {\n\t\tvar $titleEl = (0, _jquery2.default)(titleField),\n\t\t title = $titleEl.val();\n\n\t\t// Ensure the connection title is not blank.\n\t\tif (validateField($titleEl, event)) {\n\n\t\t\t// Disable the button during the ajax request.\n\t\t\t(0, _jquery2.default)(beginAuthorize).addClass('disabled');\n\n\t\t\t// Remove any error highlighting.\n\t\t\t$titleEl.removeClass('error-required');\n\n\t\t\t// Make an ajax request to save the connection and retrieve the resulting post id.\n\t\t\t_jquery2.default.ajax({\n\t\t\t\turl: _window.ajaxurl,\n\t\t\t\tmethod: 'post',\n\t\t\t\tdata: {\n\t\t\t\t\tnonce: _window.dt.nonce,\n\t\t\t\t\taction: 'dt_begin_authorization',\n\t\t\t\t\ttitle: title,\n\t\t\t\t\tid: (0, _jquery2.default)(document.getElementById('post_ID')).val()\n\t\t\t\t}\n\t\t\t}).done(function (response) {\n\t\t\t\tif (response.success && response.data.id) {\n\n\t\t\t\t\t// The post has been saved, update the url in case the user refreshes.\n\t\t\t\t\tvar url = _window.dt.admin_url + 'post.php?post=' + response.data.id + '&action=edit';\n\t\t\t\t\thistory.pushState({}, 'Oauth Authorize Details', url);\n\n\t\t\t\t\t// Update the form field for dt_redirect_uri and post id.\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('dt_redirect_uri')).val(url);\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('dt_created_post_id')).val(response.data.id);\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('original_post_status')).val('publish');\n\n\t\t\t\t\t// Hide the first step and show the authentication details.\n\t\t\t\t\t(0, _jquery2.default)('.oauth-begin-authentication-wrapper').hide();\n\t\t\t\t\t$authenticationDetailsWrapper.show();\n\t\t\t\t} else {\n\t\t\t\t\t// @todo handle errors.\n\t\t\t\t}\n\t\t\t}).complete(function () {\n\n\t\t\t\t// Ensure the\n\t\t\t\t(0, _jquery2.default)(beginAuthorize).removeClass('disabled');\n\t\t\t});\n\t\t}\n\t});\n}\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// admin-external-connection.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap dc0891300b56d8a91118","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","module.exports = _;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"_\"\n// module id = 2\n// module chunks = 0 1","import jQuery from 'jquery';\nimport _ from 'underscores';\nimport { dt, ajaxurl } from 'window';\n\nconst externalConnectionUrlField = document.getElementsByClassName( 'external-connection-url-field' )[0];\nconst externalConnectionMetaBox = document.getElementById( 'dt_external_connection_details' );\nconst externalConnectionTypeField = document.getElementsByClassName( 'external-connection-type-field' )[0];\nconst authFields = document.getElementsByClassName( 'auth-field' );\nconst rolesAllowed = document.getElementsByClassName( 'dt-roles-allowed' );\nconst titleField = document.getElementById( 'title' );\nconst endpointResult = document.querySelector( '.endpoint-result' );\nconst endpointErrors = document.querySelector( '.endpoint-errors' );\nconst postIdField = document.getElementById( 'post_ID' );\nlet $apiVerify = false;\n\n/**\n * Check the external connection.\n */\nfunction checkConnections() {\n\tif ( false !== $apiVerify ) {\n\t\t$apiVerify.abort();\n\t}\n\n\tif ( '' === externalConnectionUrlField.value ) {\n\t\tendpointErrors.innerText = '';\n\t\tendpointResult.innerText = '';\n\n\t\tendpointResult.removeAttribute( 'data-endpoint-state' );\n\t\treturn;\n\t}\n\n\tendpointResult.setAttribute( 'data-endpoint-state', 'loading' );\n\tendpointResult.innerText = dt.endpoint_checking_message;\n\n\tendpointErrors.innerText = '';\n\n\tconst auth = {};\n\n\t_.each( authFields, ( authField ) => {\n\t\tif ( authField.disabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar key = authField.getAttribute( 'data-auth-field' );\n\n\t\tif ( key ) {\n\t\t\tauth[key] = authField.value;\n\t\t}\n\t} );\n\n\tlet postId = 0;\n\tif ( postIdField && postIdField.value ) {\n\t\tpostId = postIdField.value;\n\t}\n\n\t$apiVerify = jQuery.ajax( {\n\t\turl: ajaxurl,\n\t\tmethod: 'post',\n\t\tdata: {\n\t\t\tnonce: dt.nonce,\n\t\t\taction: 'dt_verify_external_connection',\n\t\t\tauth: auth,\n\t\t\turl: externalConnectionUrlField.value,\n\t\t\ttype: externalConnectionTypeField.value,\n\t\t\tendpointId: postId\n\t\t}\n\t} ).done( ( response ) => {\n\t\tif ( ! response.success ) {\n\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'error' );\n\t\t} else {\n\t\t\tif ( response.data.errors.no_external_connection ) {\n\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'error' );\n\n\t\t\t\tif ( response.data.endpoint_suggestion ) {\n\t\t\t\t\tendpointResult.innerText = dt.endpoint_suggestion + ' ';\n\n\t\t\t\t\tconst suggestion = document.createElement( 'a' );\n\t\t\t\t\tsuggestion.classList.add( 'suggest' );\n\t\t\t\t\tsuggestion.innerText = response.data.endpoint_suggestion;\n\n\t\t\t\t\tendpointResult.appendChild( suggestion );\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.innerText = dt.bad_connection;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( response.data.errors.no_distributor || ! response.data.can_post.length ) {\n\t\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'warning' );\n\t\t\t\t\tendpointResult.innerText = dt.limited_connection;\n\n\t\t\t\t\tconst warnings = [];\n\n\t\t\t\t\tif ( response.data.errors.no_distributor ) {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + dt.no_distributor;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + dt.bad_auth;\n\t\t\t\t\t}\n\n\t\t\t\t\twarnings.push( dt.no_push );\n\t\t\t\t\twarnings.push( dt.pull_limited );\n\n\t\t\t\t\twarnings.forEach( ( warning ) => {\n\t\t\t\t\t\tconst warningNode = document.createElement( 'li' );\n\t\t\t\t\t\twarningNode.innerText = warning;\n\n\t\t\t\t\t\tendpointErrors.append( warningNode );\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'valid' );\n\t\t\t\t\tendpointResult.innerText = dt.good_connection;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} ).complete( () => {\n\t\tendpointResult.classList.remove( 'loading' );\n\t} );\n}\n\nsetTimeout( () => {\n\tcheckConnections();\n}, 300 );\n\njQuery( externalConnectionMetaBox ).on( 'click', '.suggest', ( event ) => {\n\texternalConnectionUrlField.value = event.currentTarget.innerText;\n\tjQuery( externalConnectionUrlField ).trigger( 'input' );\n} );\n\njQuery( externalConnectionMetaBox ).on( 'keyup input', '.auth-field, .external-connection-url-field', _.debounce( checkConnections, 250 ) );\n\njQuery( externalConnectionUrlField ).on( 'blur', ( event ) => {\n\tif ( '' === titleField.value && '' !== event.currentTarget.value ) {\n\t\ttitleField.value = event.currentTarget.value.replace( /https?:\\/\\//i, '' );\n\t\ttitleField.focus();\n\t\ttitleField.blur();\n\t}\n} );\n/**\n * JS for basic auth\n *\n * @todo separate\n */\nconst passwordField = document.getElementById( 'dt_password' );\nconst usernameField = document.getElementById( 'dt_username' );\nconst changePassword = document.querySelector( '.change-password' );\n\njQuery( usernameField ).on( 'keyup change', _.debounce( () => {\n\tif ( changePassword ) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tchangePassword.style.display = 'none';\n\t}\n}, 250 ) );\n\njQuery( changePassword ).on( 'click', ( event ) => {\n\tevent.preventDefault();\n\n\tif ( passwordField.disabled ) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tevent.currentTarget.innerText = dt.cancel;\n\t} else {\n\t\tpasswordField.disabled = true;\n\t\tpasswordField.value = 'sdfdsfsdfdsfdsfsd'; // filler password\n\t\tevent.currentTarget.innerText = dt.change;\n\t}\n\n\tcheckConnections();\n} );\n\njQuery( rolesAllowed ).on( 'click', '.dt-role-checkbox', ( event ) => {\n\tif ( ! event.target.classList.contains( 'dt-role-checkbox' ) ) {\n\t\treturn;\n\t}\n\n\tif ( ! event.target.checked ) {\n\t\treturn;\n\t}\n\n\tif ( 'administrator' !== event.target.value && 'editor' !== event.target.value ) {\n\t\talert( dt.roles_warning ); // eslint-disable-line no-alert\n\t}\n} );\n\n/**\n * Code for WordPress.com Oauth2 Authentication.\n *\n * @todo separate out code.\n */\n\n/**\n * If the client id and secret are unavailable, hide all '.hide-until-authed' areas.\n *\n * For Oauth authentication, simplify the interface by hiding certain elements until the user has\n * completed the authorization process.\n *\n * Creates a cleaner flow for authorization by separating the authorization steps.\n */\nconst $hideUntilAuthed = jQuery( '.hide-until-authed' ),\n\t$authCredentials = jQuery( '.auth-credentials' ),\n\t$clientSecret = jQuery( document.getElementById( 'dt_client_secret' ) ),\n\t$clientId = jQuery( document.getElementById( 'dt_client_id' ) ),\n\thideItemsRequiringAuth = () => {\n\t\tconst oauthconnectionestablished = document.getElementsByClassName( 'oauth-connection-established' );\n\t\tif ( 0 === oauthconnectionestablished.length ) {\n\t\t\t$hideUntilAuthed.hide();\n\t\t}\n\t},\n\n\t/**\n\t * Validate a form field, ensuring it is non-empty. Add an error class if empty.\n\t *\n\t * @param {jQuery DomElement} $field The field to check.\n\t */\n\tvalidateField = ( $field, event ) => {\n\t\tif ( '' === $field.val() ) {\n\t\t\tevent.preventDefault();\n\t\t\t$field.addClass( 'error-required' );\n\t\t\treturn false;\n\t\t} else {\n\t\t\t$field.removeClass( 'error-required' );\n\t\t}\n\t\treturn true;\n\t};\n\n/**\n * When the External connection type drop-down is changed, show the corresponding authorization fields.\n */\njQuery( externalConnectionTypeField ).on( 'change', () => {\n\tconst slug = externalConnectionTypeField.value;\n\n\t$authCredentials.hide();\n\tjQuery( '.auth-credentials.' + slug ).show();\n\n\t// For WordPress.com Oauth authentication, hide fields until authentication is complete.\n\tif ( 'wpdotcom' === slug ) {\n\t\thideItemsRequiringAuth();\n\t} else {\n\n\t\t// Otherwise, ensure all areas are showing.\n\t\t$hideUntilAuthed.show();\n\t}\n} );\n\n\n// On load for WordPress.com Oauth authentication, hide fields until authentication is complete.\nif ( 'wpdotcom' === externalConnectionTypeField.value ) {\n\thideItemsRequiringAuth();\n}\n\n// When authorization is initiated, ensure fields are non-empty.\nconst createConnectionButton = document.getElementById( 'create-oauth-connection' );\nif ( createConnectionButton ) {\n\tjQuery( createConnectionButton ).on( 'click', ( event ) => {\n\t\tconst validateClientSecret = validateField( $clientSecret, event ),\n\t\t\tvalidateClientId = validateField( $clientId, event );\n\t\tif (\n\t\t\t! validateClientSecret ||\n\t\t\t! validateClientId\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t}\n\t} );\n}\n\n// Handle the changeCredentials link.\nconst changeCredentials = document.getElementById( 'oauth-authentication-change-credentials' ),\n\t$authenticationDetailsWrapper = jQuery( '.oauth-authentication-details-wrapper' );\n\nif ( changeCredentials ) {\n\n\tjQuery( changeCredentials ).on( 'click', function() {\n\n\t\t// Show the credentials fields.\n\t\t$authenticationDetailsWrapper.show();\n\n\t\t// Clear the secret field.\n\t\t$clientSecret.val( '' );\n\n\t\t// Remove the authorized message.\n\t\tjQuery( '.oauth-connection-established' ).remove();\n\n\t\t// Hide the remaining fields that only show after authorization is complete.\n\t\thideItemsRequiringAuth();\n\t} );\n}\n\n// Handle the Authorize Connection button.\nconst beginAuthorize = document.getElementById( 'begin-authorization' );\nif ( beginAuthorize ) {\n\n\t// Handle click to the wpdotcom begin-authorization button.\n\tjQuery( beginAuthorize ).on( 'click', ( event ) => {\n\t\tconst $titleEl = jQuery( titleField ),\n\t\t\ttitle = $titleEl.val();\n\n\t\t// Ensure the connection title is not blank.\n\t\tif ( validateField( $titleEl, event ) ) {\n\n\t\t\t// Disable the button during the ajax request.\n\t\t\tjQuery( beginAuthorize ).addClass( 'disabled' );\n\n\t\t\t// Remove any error highlighting.\n\t\t\t$titleEl.removeClass( 'error-required' );\n\n\t\t\t// Make an ajax request to save the connection and retrieve the resulting post id.\n\t\t\tjQuery.ajax( {\n\t\t\t\turl: ajaxurl,\n\t\t\t\tmethod: 'post',\n\t\t\t\tdata: {\n\t\t\t\t\tnonce: dt.nonce,\n\t\t\t\t\taction: 'dt_begin_authorization',\n\t\t\t\t\ttitle: title,\n\t\t\t\t\tid: jQuery( document.getElementById( 'post_ID' ) ).val()\n\t\t\t\t}\n\t\t\t} ).done( ( response ) => {\n\t\t\t\tif ( response.success && response.data.id ) {\n\n\t\t\t\t\t// The post has been saved, update the url in case the user refreshes.\n\t\t\t\t\tconst url = dt.admin_url + 'post.php?post=' + response.data.id + '&action=edit';\n\t\t\t\t\thistory.pushState( {}, 'Oauth Authorize Details', url );\n\n\t\t\t\t\t// Update the form field for dt_redirect_uri and post id.\n\t\t\t\t\tjQuery( document.getElementById( 'dt_redirect_uri' ) ).val( url );\n\t\t\t\t\tjQuery( document.getElementById( 'dt_created_post_id' ) ).val( response.data.id );\n\t\t\t\t\tjQuery( document.getElementById( 'original_post_status' ) ).val( 'publish' );\n\n\t\t\t\t\t// Hide the first step and show the authentication details.\n\t\t\t\t\tjQuery( '.oauth-begin-authentication-wrapper' ).hide();\n\t\t\t\t\t$authenticationDetailsWrapper.show();\n\t\t\t\t} else {\n\t\t\t\t\t// @todo handle errors.\n\t\t\t\t}\n\t\t\t} ).complete( () => {\n\n\t\t\t\t// Ensure the\n\t\t\t\tjQuery( beginAuthorize ).removeClass( 'disabled' );\n\t\t\t} );\n\t\t}\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-external-connection.js"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/js/admin-pull.min.js.map b/dist/js/admin-pull.min.js.map index 3b74518bf..beffd608a 100644 --- a/dist/js/admin-pull.min.js.map +++ b/dist/js/admin-pull.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///admin-pull.min.js","webpack:///webpack/bootstrap fff10cbf8520b51427a4","webpack:///external \"jQuery\"","webpack:///./assets/js/admin-pull.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","_jquery","_jquery2","obj","default","chooseConnection","document","getElementById","choosePostType","choosePostTypeBtn","searchField","searchBtn","form","on","event","location","currentTarget","options","selectedIndex","getAttribute","body","className","preventDefault","getURL","search","value","postType","baseURL","status","indexOf"],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AME,cAAcE,eAAeC,aAAc,iBAEjGb,SAASc,KAAKC,WAAa,gBAGvBhB,GAAoBG,GAAkBI,IAErCH,IACJ,EAAAP,EAAAE,SAAQK,GAAoBI,GAAI,QAAS,SAAEC,GAE1CA,EAAMQ,iBAENhB,SAASS,SAAWQ,IAEpBjB,SAASc,KAAKC,WAAa,gBAIxBX,GAAeC,IACnB,EAAAT,EAAAE,SAAQO,GAAYE,GAAI,QAAS,SAAEC,GAClCA,EAAMQ,gBAEN,IAAME,GAASd,EAAYe,KAE3BnB,UAASS,SAAWQ,IAAW,MAAQC,EAEvClB,SAASc,KAAKC,WAAa,gBAU9B,IAAME,GAAS,WACd,GAAMG,GAAWlB,EAAeS,QAAST,EAAeU,eAAgBO,MAClEE,EAAUtB,EAAiBY,QAASZ,EAAiBa,eAAgBC,aAAc,iBACrFS,EAAS,KAQb,QANM,GAAM,IAAMhB,EAAKS,UAAY,KAAMQ,QAAS,oBACjDD,EAAS,WACG,GAAM,IAAMhB,EAAKS,UAAY,KAAMQ,QAAS,qBACxDD,EAAS,UAGHD,EAAU,mBAAqBD,EAAW,WAAaE","file":"admin-pull.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 4);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */,\n/* 2 */,\n/* 3 */,\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar chooseConnection = document.getElementById('pull_connections');\nvar choosePostType = document.getElementById('pull_post_type');\nvar choosePostTypeBtn = document.getElementById('pull_post_type_submit');\nvar searchField = document.getElementById('post-search-input');\nvar searchBtn = document.getElementById('search-submit');\nvar form = document.getElementById('posts-filter');\n\n(0, _jquery2.default)(chooseConnection).on('change', function (event) {\n\n\tdocument.location = event.currentTarget.options[event.currentTarget.selectedIndex].getAttribute('data-pull-url');\n\n\tdocument.body.className += ' ' + 'dt-loading';\n});\n\nif (chooseConnection && choosePostType && form) {\n\n\tif (choosePostTypeBtn) {\n\t\t(0, _jquery2.default)(choosePostTypeBtn).on('click', function (event) {\n\n\t\t\tevent.preventDefault();\n\n\t\t\tdocument.location = getURL();\n\n\t\t\tdocument.body.className += ' ' + 'dt-loading';\n\t\t});\n\t}\n\n\tif (searchField && searchBtn) {\n\t\t(0, _jquery2.default)(searchBtn).on('click', function (event) {\n\t\t\tevent.preventDefault();\n\n\t\t\tvar search = searchField.value;\n\n\t\t\tdocument.location = getURL() + '&s=' + search;\n\n\t\t\tdocument.body.className += ' ' + 'dt-loading';\n\t\t});\n\t}\n}\n\n/**\n * Build our Distribution URL.\n *\n * @return {string}\n */\nvar getURL = function getURL() {\n\tvar postType = choosePostType.options[choosePostType.selectedIndex].value;\n\tvar baseURL = chooseConnection.options[chooseConnection.selectedIndex].getAttribute('data-pull-url');\n\tvar status = 'new';\n\n\tif (-1 < (' ' + form.className + ' ').indexOf(' status-skipped ')) {\n\t\tstatus = 'skipped';\n\t} else if (-1 < (' ' + form.className + ' ').indexOf(' status-pulled ')) {\n\t\tstatus = 'pulled';\n\t}\n\n\treturn baseURL + '&pull_post_type=' + postType + '&status=' + status;\n};\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// admin-pull.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fff10cbf8520b51427a4","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","import jQuery from 'jquery';\n\nconst chooseConnection = document.getElementById( 'pull_connections' );\nconst choosePostType = document.getElementById( 'pull_post_type' );\nconst choosePostTypeBtn = document.getElementById( 'pull_post_type_submit' );\nconst searchField = document.getElementById( 'post-search-input' );\nconst searchBtn = document.getElementById( 'search-submit' );\nconst form = document.getElementById( 'posts-filter' );\n\njQuery( chooseConnection ).on( 'change', ( event ) => {\n\n\tdocument.location = event.currentTarget.options[event.currentTarget.selectedIndex].getAttribute( 'data-pull-url' );\n\n\tdocument.body.className += ' ' + 'dt-loading';\n} );\n\nif ( chooseConnection && choosePostType && form ) {\n\n\tif ( choosePostTypeBtn ) {\n\t\tjQuery( choosePostTypeBtn ).on( 'click', ( event ) => {\n\n\t\t\tevent.preventDefault();\n\n\t\t\tdocument.location = getURL();\n\n\t\t\tdocument.body.className += ' ' + 'dt-loading';\n\t\t} );\n\t}\n\n\tif ( searchField && searchBtn ) {\n\t\tjQuery( searchBtn ).on( 'click', ( event ) => {\n\t\t\tevent.preventDefault();\n\n\t\t\tconst search = searchField.value;\n\n\t\t\tdocument.location = getURL() + '&s=' + search;\n\n\t\t\tdocument.body.className += ' ' + 'dt-loading';\n\t\t} );\n\t}\n}\n\n/**\n * Build our Distribution URL.\n *\n * @return {string}\n */\nconst getURL = () => {\n\tconst postType = choosePostType.options[ choosePostType.selectedIndex ].value;\n\tconst baseURL = chooseConnection.options[ chooseConnection.selectedIndex ].getAttribute( 'data-pull-url' );\n\tlet status = 'new';\n\n\tif ( -1 < ( ' ' + form.className + ' ' ).indexOf( ' status-skipped ' ) ) {\n\t\tstatus = 'skipped';\n\t} else if ( -1 < ( ' ' + form.className + ' ' ).indexOf( ' status-pulled ' ) ) {\n\t\tstatus = 'pulled';\n\t}\n\n\treturn baseURL + '&pull_post_type=' + postType + '&status=' + status;\n};\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-pull.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///admin-pull.min.js","webpack:///webpack/bootstrap dc0891300b56d8a91118","webpack:///external \"jQuery\"","webpack:///./assets/js/admin-pull.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","_jquery","_jquery2","obj","default","chooseConnection","document","getElementById","choosePostType","choosePostTypeBtn","searchField","searchBtn","form","on","event","location","currentTarget","options","selectedIndex","getAttribute","body","className","preventDefault","getURL","search","value","postType","baseURL","status","indexOf"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMM,SAAUtB,EAAQD,GEnExBC,EAAAD,QAAAwB,QFwEO,CACA,CACA,CAED,SAAUvB,EAAQD,EAASH,GAEjC,YG9EA,IAAA4B,GAAA5B,EAAA,GHmFI6B,EAEJ,SAAgCC,GAAO,MAAOA,IAAOA,EAAIV,WAAaU,GAAQC,QAASD,IAFjDF,GGjFhCI,EAAmBC,SAASC,eAAgB,oBAC5CC,EAAiBF,SAASC,eAAgB,kBAC1CE,EAAoBH,SAASC,eAAgB,yBAC7CG,EAAcJ,SAASC,eAAgB,qBACvCI,EAAYL,SAASC,eAAgB,iBACrCK,EAAON,SAASC,eAAgB,iBAEtC,EAAAL,EAAAE,SAAQC,GAAmBQ,GAAI,SAAU,SAAEC,GAE1CR,SAASS,SAAWD,EAAME,cAAcC,QAAQH,EAAME,cAAcE,eAAeC,aAAc,iBAEjGb,SAASc,KAAKC,WAAa,gBAGvBhB,GAAoBG,GAAkBI,IAErCH,IACJ,EAAAP,EAAAE,SAAQK,GAAoBI,GAAI,QAAS,SAAEC,GAE1CA,EAAMQ,iBAENhB,SAASS,SAAWQ,IAEpBjB,SAASc,KAAKC,WAAa,gBAIxBX,GAAeC,IACnB,EAAAT,EAAAE,SAAQO,GAAYE,GAAI,QAAS,SAAEC,GAClCA,EAAMQ,gBAEN,IAAME,GAASd,EAAYe,KAE3BnB,UAASS,SAAWQ,IAAW,MAAQC,EAEvClB,SAASc,KAAKC,WAAa,gBAU9B,IAAME,GAAS,WACd,GAAMG,GAAWlB,EAAeS,QAAST,EAAeU,eAAgBO,MAClEE,EAAUtB,EAAiBY,QAASZ,EAAiBa,eAAgBC,aAAc,iBACrFS,EAAS,KAQb,QANM,GAAM,IAAMhB,EAAKS,UAAY,KAAMQ,QAAS,oBACjDD,EAAS,WACG,GAAM,IAAMhB,EAAKS,UAAY,KAAMQ,QAAS,qBACxDD,EAAS,UAGHD,EAAU,mBAAqBD,EAAW,WAAaE","file":"admin-pull.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 4);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */,\n/* 2 */,\n/* 3 */,\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar chooseConnection = document.getElementById('pull_connections');\nvar choosePostType = document.getElementById('pull_post_type');\nvar choosePostTypeBtn = document.getElementById('pull_post_type_submit');\nvar searchField = document.getElementById('post-search-input');\nvar searchBtn = document.getElementById('search-submit');\nvar form = document.getElementById('posts-filter');\n\n(0, _jquery2.default)(chooseConnection).on('change', function (event) {\n\n\tdocument.location = event.currentTarget.options[event.currentTarget.selectedIndex].getAttribute('data-pull-url');\n\n\tdocument.body.className += ' ' + 'dt-loading';\n});\n\nif (chooseConnection && choosePostType && form) {\n\n\tif (choosePostTypeBtn) {\n\t\t(0, _jquery2.default)(choosePostTypeBtn).on('click', function (event) {\n\n\t\t\tevent.preventDefault();\n\n\t\t\tdocument.location = getURL();\n\n\t\t\tdocument.body.className += ' ' + 'dt-loading';\n\t\t});\n\t}\n\n\tif (searchField && searchBtn) {\n\t\t(0, _jquery2.default)(searchBtn).on('click', function (event) {\n\t\t\tevent.preventDefault();\n\n\t\t\tvar search = searchField.value;\n\n\t\t\tdocument.location = getURL() + '&s=' + search;\n\n\t\t\tdocument.body.className += ' ' + 'dt-loading';\n\t\t});\n\t}\n}\n\n/**\n * Build our Distribution URL.\n *\n * @return {string}\n */\nvar getURL = function getURL() {\n\tvar postType = choosePostType.options[choosePostType.selectedIndex].value;\n\tvar baseURL = chooseConnection.options[chooseConnection.selectedIndex].getAttribute('data-pull-url');\n\tvar status = 'new';\n\n\tif (-1 < (' ' + form.className + ' ').indexOf(' status-skipped ')) {\n\t\tstatus = 'skipped';\n\t} else if (-1 < (' ' + form.className + ' ').indexOf(' status-pulled ')) {\n\t\tstatus = 'pulled';\n\t}\n\n\treturn baseURL + '&pull_post_type=' + postType + '&status=' + status;\n};\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// admin-pull.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap dc0891300b56d8a91118","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","import jQuery from 'jquery';\n\nconst chooseConnection = document.getElementById( 'pull_connections' );\nconst choosePostType = document.getElementById( 'pull_post_type' );\nconst choosePostTypeBtn = document.getElementById( 'pull_post_type_submit' );\nconst searchField = document.getElementById( 'post-search-input' );\nconst searchBtn = document.getElementById( 'search-submit' );\nconst form = document.getElementById( 'posts-filter' );\n\njQuery( chooseConnection ).on( 'change', ( event ) => {\n\n\tdocument.location = event.currentTarget.options[event.currentTarget.selectedIndex].getAttribute( 'data-pull-url' );\n\n\tdocument.body.className += ' ' + 'dt-loading';\n} );\n\nif ( chooseConnection && choosePostType && form ) {\n\n\tif ( choosePostTypeBtn ) {\n\t\tjQuery( choosePostTypeBtn ).on( 'click', ( event ) => {\n\n\t\t\tevent.preventDefault();\n\n\t\t\tdocument.location = getURL();\n\n\t\t\tdocument.body.className += ' ' + 'dt-loading';\n\t\t} );\n\t}\n\n\tif ( searchField && searchBtn ) {\n\t\tjQuery( searchBtn ).on( 'click', ( event ) => {\n\t\t\tevent.preventDefault();\n\n\t\t\tconst search = searchField.value;\n\n\t\t\tdocument.location = getURL() + '&s=' + search;\n\n\t\t\tdocument.body.className += ' ' + 'dt-loading';\n\t\t} );\n\t}\n}\n\n/**\n * Build our Distribution URL.\n *\n * @return {string}\n */\nconst getURL = () => {\n\tconst postType = choosePostType.options[ choosePostType.selectedIndex ].value;\n\tconst baseURL = chooseConnection.options[ chooseConnection.selectedIndex ].getAttribute( 'data-pull-url' );\n\tlet status = 'new';\n\n\tif ( -1 < ( ' ' + form.className + ' ' ).indexOf( ' status-skipped ' ) ) {\n\t\tstatus = 'skipped';\n\t} else if ( -1 < ( ' ' + form.className + ' ' ).indexOf( ' status-pulled ' ) ) {\n\t\tstatus = 'pulled';\n\t}\n\n\treturn baseURL + '&pull_post_type=' + postType + '&status=' + status;\n};\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-pull.js"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/js/gutenberg-status-plugin.min.js.map b/dist/js/gutenberg-status-plugin.min.js.map index 4d96f4f94..325dc9805 100644 --- a/dist/js/gutenberg-status-plugin.min.js.map +++ b/dist/js/gutenberg-status-plugin.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///gutenberg-status-plugin.min.js","webpack:///webpack/bootstrap fff10cbf8520b51427a4","webpack:///external \"window\"","webpack:///./assets/js/gutenberg-status-plugin.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","1","window","8","_window","wp","editPost","PluginPostStatusInfo","registerPlugin","plugins","__","i18n","renderDistributedFrom","React","createElement","id","dtGutenberg","syndicationTime","renderDistributedTo","sprintf","syndicationCount","parseInt","render"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMMC,EACA,SAAUvB,EAAQD,GEpExBC,EAAAD,QAAAyB,QF0EMC,EACA,SAAUzB,EAAQD,EAASH,GAEjC,YG7EA,IAAA8B,GAAA9B,EAAA,EAEA,QAAK,KAAuB8B,EAAAC,GAAGC,SAASC,qBAAuB,IACtDC,GAAmBJ,EAAAC,GAAGI,QAAtBD,eACAE,EAAON,EAAAC,GAAGM,KAAVD,GACAH,EAAyBH,EAAAC,GAAGC,SAA5BC,qBAKFK,EAAwB,WAC7B,MACCC,OAAAC,cAACP,EAAD,KACCM,MAAAC,cAAA,QAAMC,GAAG,oBACNL,EAAI,oBACNG,MAAAC,cAAA,kBAAWV,EAAAY,YAAYC,gBAAvB,QASEC,EAAsB,WAC3B,MACCL,OAAAC,cAACP,EAAD,KACCM,MAAAC,cAAA,QAAMC,GAAG,kBACNX,EAAAC,GAAGM,KAAKQ,QAASf,EAAAC,GAAGM,KAAKD,GAAI,sCAAuC,eACrEN,EAAAY,YAAYI,iBACZ,MAAQhB,EAAAY,YAAYI,iBAAmB,GAAK,OAM5C,GAAIC,SAAUjB,EAAAY,YAAYI,kBAC9BZ,EAAgB,4BAA8Bc,OAAQJ,IAC3C,IAAMG,SAAUjB,EAAAY,YAAYC,kBACvCT,EAAgB,4BAA8Bc,OAAQV","file":"gutenberg-status-plugin.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 8);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 1:\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n\n/***/ 8:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _window = __webpack_require__(1);\n\nif ('undefined' !== typeof _window.wp.editPost.PluginPostStatusInfo) {\n\tvar registerPlugin = _window.wp.plugins.registerPlugin;\n\tvar __ = _window.wp.i18n.__;\n\tvar PluginPostStatusInfo = _window.wp.editPost.PluginPostStatusInfo; // eslint-disable-line no-unused-vars\n\n\t/**\n * Render the distributed from component.\n */\n\n\tvar renderDistributedFrom = function renderDistributedFrom() {\n\t\treturn React.createElement(\n\t\t\tPluginPostStatusInfo,\n\t\t\tnull,\n\t\t\tReact.createElement(\n\t\t\t\t'span',\n\t\t\t\t{ id: 'distributed-from' },\n\t\t\t\t__('Distributed on: '),\n\t\t\t\tReact.createElement(\n\t\t\t\t\t'strong',\n\t\t\t\t\tnull,\n\t\t\t\t\t' ',\n\t\t\t\t\t_window.dtGutenberg.syndicationTime,\n\t\t\t\t\t' '\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t};\n\n\t/**\n * Render the distributed to component.\n */\n\tvar renderDistributedTo = function renderDistributedTo() {\n\t\treturn React.createElement(\n\t\t\tPluginPostStatusInfo,\n\t\t\tnull,\n\t\t\tReact.createElement(\n\t\t\t\t'span',\n\t\t\t\t{ id: 'distributed-to' },\n\t\t\t\t_window.wp.i18n.sprintf(_window.wp.i18n.__('Distributed to %1$s connection%2$s.', 'distributor'), _window.dtGutenberg.syndicationCount, '1' === _window.dtGutenberg.syndicationCount ? '' : 's')\n\t\t\t)\n\t\t);\n\t};\n\n\tif (0 < parseInt(_window.dtGutenberg.syndicationCount)) {\n\t\tregisterPlugin('distributor-status-panel', { render: renderDistributedTo });\n\t} else if (0 !== parseInt(_window.dtGutenberg.syndicationTime)) {\n\t\tregisterPlugin('distributor-status-panel', { render: renderDistributedFrom });\n\t}\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// gutenberg-status-plugin.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 8);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fff10cbf8520b51427a4","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","import { wp, dtGutenberg } from 'window';\n\nif ( 'undefined' !== typeof wp.editPost.PluginPostStatusInfo ) {\n\tconst { registerPlugin } = wp.plugins;\n\tconst { __ } = wp.i18n;\n\tconst { PluginPostStatusInfo } = wp.editPost; // eslint-disable-line no-unused-vars\n\n\t/**\n\t * Render the distributed from component.\n\t */\n\tconst renderDistributedFrom = () => {\n\t\treturn(\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ __( 'Distributed on: ' ) }\n\t\t\t\t\t { dtGutenberg.syndicationTime } \n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n\n\t/**\n\t * Render the distributed to component.\n\t */\n\tconst renderDistributedTo = () => {\n\t\treturn(\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ wp.i18n.sprintf( wp.i18n.__( 'Distributed to %1$s connection%2$s.', 'distributor' ),\n\t\t\t\t\t\tdtGutenberg.syndicationCount,\n\t\t\t\t\t\t'1' === dtGutenberg.syndicationCount ? '' : 's' ) }\n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n\n\tif ( 0 < parseInt( dtGutenberg.syndicationCount ) ) {\n\t\tregisterPlugin( 'distributor-status-panel', { render: renderDistributedTo } );\n\t} else if ( 0 !== parseInt( dtGutenberg.syndicationTime ) ) {\n\t\tregisterPlugin( 'distributor-status-panel', { render: renderDistributedFrom } );\n\t}\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/gutenberg-status-plugin.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///gutenberg-status-plugin.min.js","webpack:///webpack/bootstrap dc0891300b56d8a91118","webpack:///external \"window\"","webpack:///./assets/js/gutenberg-status-plugin.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","1","window","8","_window","wp","editPost","PluginPostStatusInfo","registerPlugin","plugins","__","i18n","renderDistributedFrom","React","createElement","id","dtGutenberg","syndicationTime","renderDistributedTo","sprintf","syndicationCount","parseInt","render"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMMC,EACA,SAAUvB,EAAQD,GEpExBC,EAAAD,QAAAyB,QF0EMC,EACA,SAAUzB,EAAQD,EAASH,GAEjC,YG7EA,IAAA8B,GAAA9B,EAAA,EAEA,QAAK,KAAuB8B,EAAAC,GAAGC,SAASC,qBAAuB,IACtDC,GAAmBJ,EAAAC,GAAGI,QAAtBD,eACAE,EAAON,EAAAC,GAAGM,KAAVD,GACAH,EAAyBH,EAAAC,GAAGC,SAA5BC,qBAKFK,EAAwB,WAC7B,MACCC,OAAAC,cAACP,EAAD,KACCM,MAAAC,cAAA,QAAMC,GAAG,oBACNL,EAAI,oBACNG,MAAAC,cAAA,kBAAWV,EAAAY,YAAYC,gBAAvB,QASEC,EAAsB,WAC3B,MACCL,OAAAC,cAACP,EAAD,KACCM,MAAAC,cAAA,QAAMC,GAAG,kBACNX,EAAAC,GAAGM,KAAKQ,QAASf,EAAAC,GAAGM,KAAKD,GAAI,sCAAuC,eACrEN,EAAAY,YAAYI,iBACZ,MAAQhB,EAAAY,YAAYI,iBAAmB,GAAK,OAM5C,GAAIC,SAAUjB,EAAAY,YAAYI,kBAC9BZ,EAAgB,4BAA8Bc,OAAQJ,IAC3C,IAAMG,SAAUjB,EAAAY,YAAYC,kBACvCT,EAAgB,4BAA8Bc,OAAQV","file":"gutenberg-status-plugin.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 8);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 1:\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n\n/***/ 8:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _window = __webpack_require__(1);\n\nif ('undefined' !== typeof _window.wp.editPost.PluginPostStatusInfo) {\n\tvar registerPlugin = _window.wp.plugins.registerPlugin;\n\tvar __ = _window.wp.i18n.__;\n\tvar PluginPostStatusInfo = _window.wp.editPost.PluginPostStatusInfo; // eslint-disable-line no-unused-vars\n\n\t/**\n * Render the distributed from component.\n */\n\n\tvar renderDistributedFrom = function renderDistributedFrom() {\n\t\treturn React.createElement(\n\t\t\tPluginPostStatusInfo,\n\t\t\tnull,\n\t\t\tReact.createElement(\n\t\t\t\t'span',\n\t\t\t\t{ id: 'distributed-from' },\n\t\t\t\t__('Distributed on: '),\n\t\t\t\tReact.createElement(\n\t\t\t\t\t'strong',\n\t\t\t\t\tnull,\n\t\t\t\t\t' ',\n\t\t\t\t\t_window.dtGutenberg.syndicationTime,\n\t\t\t\t\t' '\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t};\n\n\t/**\n * Render the distributed to component.\n */\n\tvar renderDistributedTo = function renderDistributedTo() {\n\t\treturn React.createElement(\n\t\t\tPluginPostStatusInfo,\n\t\t\tnull,\n\t\t\tReact.createElement(\n\t\t\t\t'span',\n\t\t\t\t{ id: 'distributed-to' },\n\t\t\t\t_window.wp.i18n.sprintf(_window.wp.i18n.__('Distributed to %1$s connection%2$s.', 'distributor'), _window.dtGutenberg.syndicationCount, '1' === _window.dtGutenberg.syndicationCount ? '' : 's')\n\t\t\t)\n\t\t);\n\t};\n\n\tif (0 < parseInt(_window.dtGutenberg.syndicationCount)) {\n\t\tregisterPlugin('distributor-status-panel', { render: renderDistributedTo });\n\t} else if (0 !== parseInt(_window.dtGutenberg.syndicationTime)) {\n\t\tregisterPlugin('distributor-status-panel', { render: renderDistributedFrom });\n\t}\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// gutenberg-status-plugin.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 8);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap dc0891300b56d8a91118","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","import { wp, dtGutenberg } from 'window';\n\nif ( 'undefined' !== typeof wp.editPost.PluginPostStatusInfo ) {\n\tconst { registerPlugin } = wp.plugins;\n\tconst { __ } = wp.i18n;\n\tconst { PluginPostStatusInfo } = wp.editPost; // eslint-disable-line no-unused-vars\n\n\t/**\n\t * Render the distributed from component.\n\t */\n\tconst renderDistributedFrom = () => {\n\t\treturn(\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ __( 'Distributed on: ' ) }\n\t\t\t\t\t { dtGutenberg.syndicationTime } \n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n\n\t/**\n\t * Render the distributed to component.\n\t */\n\tconst renderDistributedTo = () => {\n\t\treturn(\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ wp.i18n.sprintf( wp.i18n.__( 'Distributed to %1$s connection%2$s.', 'distributor' ),\n\t\t\t\t\t\tdtGutenberg.syndicationCount,\n\t\t\t\t\t\t'1' === dtGutenberg.syndicationCount ? '' : 's' ) }\n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n\n\tif ( 0 < parseInt( dtGutenberg.syndicationCount ) ) {\n\t\tregisterPlugin( 'distributor-status-panel', { render: renderDistributedTo } );\n\t} else if ( 0 !== parseInt( dtGutenberg.syndicationTime ) ) {\n\t\tregisterPlugin( 'distributor-status-panel', { render: renderDistributedFrom } );\n\t}\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/gutenberg-status-plugin.js"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/js/gutenberg-syndicated-post.min.js.map b/dist/js/gutenberg-syndicated-post.min.js.map index ddb760d59..e1f6c7507 100644 --- a/dist/js/gutenberg-syndicated-post.min.js.map +++ b/dist/js/gutenberg-syndicated-post.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///gutenberg-syndicated-post.min.js","webpack:///webpack/bootstrap fff10cbf8520b51427a4","webpack:///external \"window\"","webpack:///./assets/js/gutenberg-syndicated-post.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","1","window","7","_window","wp","i18n","setLocaleData","dtGutenberg","originalSourceId","originalBlogId","message","actions","parseInt","originalDelete","sprintf","__","postTypeSingular","originalLocationName","unlinked","push","label","url","linkNonceUrl","postUrl","unlinkNonceUrl","data","dispatch","createWarningNotice","id"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMMC,EACA,SAAUvB,EAAQD,GEpExBC,EAAAD,QAAAyB,QF0EMC,EACA,SAAUzB,EAAQD,EAASH,GAEjC,YG7EA,IAAA8B,GAAA9B,EAAA,EAKA,IAFA8B,EAAAC,GAAGC,KAAKC,cAAeH,EAAAI,YAAYF,KAAM,eAEpC,MAAQF,EAAAI,YAAYC,kBAAoB,MAAQL,EAAAI,YAAYE,eAAiB,CAEjF,GAAIC,GAAU,GACRC,IAEDC,UAAUT,EAAAI,YAAYM,gBAC1BH,EAAUP,EAAAC,GAAGC,KAAKS,QAASX,EAAAC,GAAGC,KAAKU,GAAI,gFAAkFZ,EAAAI,YAAYS,iBAAkBb,EAAAI,YAAYU,sBACtJL,SAAUT,EAAAI,YAAYW,WAenCR,EAAUP,EAAAC,GAAGC,KAAKS,QAASX,EAAAC,GAAGC,KAAKU,GAAI,2GAA4G,eAAiBZ,EAAAI,YAAYU,qBAAsBd,EAAAI,YAAYS,kBAElNL,EAAQQ,MACPC,MAAOjB,EAAAC,GAAGC,KAAMU,GAAI,cAAe,eACnCM,IAAKlB,EAAAI,YAAYe,eAGlBX,EAAQQ,MACPC,MAAOjB,EAAAC,GAAGC,KAAMU,GAAI,gBAAiB,eACrCM,IAAKlB,EAAAI,YAAYgB,YAvBlBb,EAAUP,EAAAC,GAAGC,KAAKS,QAASX,EAAAC,GAAGC,KAAKU,GAAI,gEAAiE,eAAiBZ,EAAAI,YAAYU,sBAErIN,EAAQQ,MACPC,MAAOjB,EAAAC,GAAGC,KAAMU,GAAI,wBAAyB,eAC7CM,IAAKlB,EAAAI,YAAYiB,iBAGlBb,EAAQQ,MACPC,MAAOjB,EAAAC,GAAGC,KAAKU,GAAI,gBAAiB,eACpCM,IAAKlB,EAAAI,YAAYgB,WAkBnBpB,EAAAC,GAAGqB,KAAKC,SAAU,gBAAiBC,oBAAqBjB,GACvDkB,GAAI,qBACJjB","file":"gutenberg-syndicated-post.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 7);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 1:\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n\n/***/ 7:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _window = __webpack_require__(1);\n\n_window.wp.i18n.setLocaleData(_window.dtGutenberg.i18n, 'distributor');\n\nif ('0' !== _window.dtGutenberg.originalSourceId || '0' !== _window.dtGutenberg.originalBlogId) {\n\n\tvar message = '';\n\tvar actions = [];\n\n\tif (parseInt(_window.dtGutenberg.originalDelete)) {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('This %1$s was distributed from %2$s. However, the original has been deleted.'), _window.dtGutenberg.postTypeSingular, _window.dtGutenberg.originalLocationName);\n\t} else if (!parseInt(_window.dtGutenberg.unlinked)) {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('Distributed from %s. The original will update this unless you', 'distributor'), _window.dtGutenberg.originalLocationName);\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('unlink from original.', 'distributor'),\n\t\t\turl: _window.dtGutenberg.unlinkNonceUrl\n\t\t});\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('View Original', 'distributor'),\n\t\t\turl: _window.dtGutenberg.postUrl\n\t\t});\n\t} else {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('Originally distributed from %1$s. This %2$s has been unlinked from the original. However, you can always', 'distributor'), _window.dtGutenberg.originalLocationName, _window.dtGutenberg.postTypeSingular);\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('restore it.', 'distributor'),\n\t\t\turl: _window.dtGutenberg.linkNonceUrl\n\t\t});\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('View Original', 'distributor'),\n\t\t\turl: _window.dtGutenberg.postUrl\n\t\t});\n\t}\n\n\t_window.wp.data.dispatch('core/notices').createWarningNotice(message, {\n\t\tid: 'distributor-notice',\n\t\tactions: actions\n\t});\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// gutenberg-syndicated-post.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 7);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fff10cbf8520b51427a4","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","import { wp, dtGutenberg } from 'window';\n\n\nwp.i18n.setLocaleData( dtGutenberg.i18n, 'distributor' );\n\nif ( '0' !== dtGutenberg.originalSourceId || '0' !== dtGutenberg.originalBlogId ) {\n\n\tlet message = '';\n\tconst actions = [];\n\n\tif ( parseInt( dtGutenberg.originalDelete ) ) {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'This %1$s was distributed from %2$s. However, the original has been deleted.' ), dtGutenberg.postTypeSingular, dtGutenberg.originalLocationName );\n\t} else if ( ! parseInt( dtGutenberg.unlinked ) ) {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'Distributed from %s. The original will update this unless you', 'distributor' ), dtGutenberg.originalLocationName );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'unlink from original.', 'distributor' ),\n\t\t\turl: dtGutenberg.unlinkNonceUrl\n\t\t} );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n.__( 'View Original', 'distributor' ),\n\t\t\turl: dtGutenberg.postUrl,\n\t\t} );\n\n\n\t} else {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'Originally distributed from %1$s. This %2$s has been unlinked from the original. However, you can always', 'distributor' ), dtGutenberg.originalLocationName, dtGutenberg.postTypeSingular );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'restore it.', 'distributor' ),\n\t\t\turl: dtGutenberg.linkNonceUrl\n\t\t} );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'View Original', 'distributor' ),\n\t\t\turl: dtGutenberg.postUrl\n\t\t} );\n\t}\n\n\twp.data.dispatch( 'core/notices' ).createWarningNotice( message, {\n\t\tid: 'distributor-notice',\n\t\tactions,\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/gutenberg-syndicated-post.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///gutenberg-syndicated-post.min.js","webpack:///webpack/bootstrap dc0891300b56d8a91118","webpack:///external \"window\"","webpack:///./assets/js/gutenberg-syndicated-post.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","1","window","7","_window","wp","i18n","setLocaleData","dtGutenberg","originalSourceId","originalBlogId","message","actions","parseInt","originalDelete","sprintf","__","postTypeSingular","originalLocationName","unlinked","push","label","url","linkNonceUrl","postUrl","unlinkNonceUrl","data","dispatch","createWarningNotice","id"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMMC,EACA,SAAUvB,EAAQD,GEpExBC,EAAAD,QAAAyB,QF0EMC,EACA,SAAUzB,EAAQD,EAASH,GAEjC,YG7EA,IAAA8B,GAAA9B,EAAA,EAKA,IAFA8B,EAAAC,GAAGC,KAAKC,cAAeH,EAAAI,YAAYF,KAAM,eAEpC,MAAQF,EAAAI,YAAYC,kBAAoB,MAAQL,EAAAI,YAAYE,eAAiB,CAEjF,GAAIC,GAAU,GACRC,IAEDC,UAAUT,EAAAI,YAAYM,gBAC1BH,EAAUP,EAAAC,GAAGC,KAAKS,QAASX,EAAAC,GAAGC,KAAKU,GAAI,gFAAkFZ,EAAAI,YAAYS,iBAAkBb,EAAAI,YAAYU,sBACtJL,SAAUT,EAAAI,YAAYW,WAenCR,EAAUP,EAAAC,GAAGC,KAAKS,QAASX,EAAAC,GAAGC,KAAKU,GAAI,2GAA4G,eAAiBZ,EAAAI,YAAYU,qBAAsBd,EAAAI,YAAYS,kBAElNL,EAAQQ,MACPC,MAAOjB,EAAAC,GAAGC,KAAMU,GAAI,cAAe,eACnCM,IAAKlB,EAAAI,YAAYe,eAGlBX,EAAQQ,MACPC,MAAOjB,EAAAC,GAAGC,KAAMU,GAAI,gBAAiB,eACrCM,IAAKlB,EAAAI,YAAYgB,YAvBlBb,EAAUP,EAAAC,GAAGC,KAAKS,QAASX,EAAAC,GAAGC,KAAKU,GAAI,gEAAiE,eAAiBZ,EAAAI,YAAYU,sBAErIN,EAAQQ,MACPC,MAAOjB,EAAAC,GAAGC,KAAMU,GAAI,wBAAyB,eAC7CM,IAAKlB,EAAAI,YAAYiB,iBAGlBb,EAAQQ,MACPC,MAAOjB,EAAAC,GAAGC,KAAKU,GAAI,gBAAiB,eACpCM,IAAKlB,EAAAI,YAAYgB,WAkBnBpB,EAAAC,GAAGqB,KAAKC,SAAU,gBAAiBC,oBAAqBjB,GACvDkB,GAAI,qBACJjB","file":"gutenberg-syndicated-post.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 7);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 1:\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n\n/***/ 7:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _window = __webpack_require__(1);\n\n_window.wp.i18n.setLocaleData(_window.dtGutenberg.i18n, 'distributor');\n\nif ('0' !== _window.dtGutenberg.originalSourceId || '0' !== _window.dtGutenberg.originalBlogId) {\n\n\tvar message = '';\n\tvar actions = [];\n\n\tif (parseInt(_window.dtGutenberg.originalDelete)) {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('This %1$s was distributed from %2$s. However, the original has been deleted.'), _window.dtGutenberg.postTypeSingular, _window.dtGutenberg.originalLocationName);\n\t} else if (!parseInt(_window.dtGutenberg.unlinked)) {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('Distributed from %s. The original will update this unless you', 'distributor'), _window.dtGutenberg.originalLocationName);\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('unlink from original.', 'distributor'),\n\t\t\turl: _window.dtGutenberg.unlinkNonceUrl\n\t\t});\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('View Original', 'distributor'),\n\t\t\turl: _window.dtGutenberg.postUrl\n\t\t});\n\t} else {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('Originally distributed from %1$s. This %2$s has been unlinked from the original. However, you can always', 'distributor'), _window.dtGutenberg.originalLocationName, _window.dtGutenberg.postTypeSingular);\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('restore it.', 'distributor'),\n\t\t\turl: _window.dtGutenberg.linkNonceUrl\n\t\t});\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('View Original', 'distributor'),\n\t\t\turl: _window.dtGutenberg.postUrl\n\t\t});\n\t}\n\n\t_window.wp.data.dispatch('core/notices').createWarningNotice(message, {\n\t\tid: 'distributor-notice',\n\t\tactions: actions\n\t});\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// gutenberg-syndicated-post.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 7);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap dc0891300b56d8a91118","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","import { wp, dtGutenberg } from 'window';\n\n\nwp.i18n.setLocaleData( dtGutenberg.i18n, 'distributor' );\n\nif ( '0' !== dtGutenberg.originalSourceId || '0' !== dtGutenberg.originalBlogId ) {\n\n\tlet message = '';\n\tconst actions = [];\n\n\tif ( parseInt( dtGutenberg.originalDelete ) ) {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'This %1$s was distributed from %2$s. However, the original has been deleted.' ), dtGutenberg.postTypeSingular, dtGutenberg.originalLocationName );\n\t} else if ( ! parseInt( dtGutenberg.unlinked ) ) {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'Distributed from %s. The original will update this unless you', 'distributor' ), dtGutenberg.originalLocationName );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'unlink from original.', 'distributor' ),\n\t\t\turl: dtGutenberg.unlinkNonceUrl\n\t\t} );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n.__( 'View Original', 'distributor' ),\n\t\t\turl: dtGutenberg.postUrl,\n\t\t} );\n\n\n\t} else {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'Originally distributed from %1$s. This %2$s has been unlinked from the original. However, you can always', 'distributor' ), dtGutenberg.originalLocationName, dtGutenberg.postTypeSingular );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'restore it.', 'distributor' ),\n\t\t\turl: dtGutenberg.linkNonceUrl\n\t\t} );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'View Original', 'distributor' ),\n\t\t\turl: dtGutenberg.postUrl\n\t\t} );\n\t}\n\n\twp.data.dispatch( 'core/notices' ).createWarningNotice( message, {\n\t\tid: 'distributor-notice',\n\t\tactions,\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/gutenberg-syndicated-post.js"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/js/push.min.js b/dist/js/push.min.js index 0bf936bef..71a345450 100644 --- a/dist/js/push.min.js +++ b/dist/js/push.min.js @@ -1,2 +1,2 @@ -!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t){e.exports=jQuery},function(e,t){e.exports=window},function(e,t){e.exports=_},,,,function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var o=n(0),a=r(o),c=n(2),i=r(c),s=n(1),d={},u="",l=i.default.memoize(function(e){var t=document.getElementById(e);if(!t)return!1;var n={evaluate:/<#([\s\S]+?)#>/g,interpolate:/{{{([\s\S]+?)}}}/g,escape:/{{([^}]+?)}}(?!})/g};return i.default.template(t.innerHTML,null,n)});(0,a.default)(window).on("load",function(){function e(){f.classList.add("message-error"),setTimeout(function(){f.classList.remove("message-error")},6e3)}function t(t){var r=!1;i.default.each(t.internal,function(e,t){"fail"===e.status?r=!0:s.dtConnections["internal"+t].syndicated=e.url}),i.default.each(t.external,function(e,t){"fail"===e.status?r=!0:s.dtConnections["external"+t].syndicated=!0}),r?e():(f.classList.add("message-success"),p.classList.add("empty"),m.innerText="",setTimeout(function(){f.classList.remove("message-success")},6e3)),d={},n()}function n(){g.innerText="",i.default.each(s.dtConnections,function(e){if(""!==u){var t=e.name.replace(/[^0-9a-zA-Z ]+/,"").toLowerCase().match(u.toLowerCase()),n=e.url.replace(/https?:\/\//i,"").replace(/www/i,"").replace(/[^0-9a-zA-Z ]+/,"").toLowerCase().match(u.toLowerCase());if(!t&&!n)return}var r=l("dt-add-connection")({connection:e,selectedConnections:d});g.innerHTML+=r})}function r(){c.focus(),document.body.classList.toggle("distributor-show")}function o(){c.blur(),document.body.classList.toggle("distributor-show")}var c=document.querySelector("#wp-admin-bar-distributor"),f=document.querySelector("#distributor-push-wrapper");if(c&&f){var p=f.querySelector(".connections-selected"),m=f.querySelector(".selected-connections-list"),g=f.querySelector(".new-connections-list"),v=document.getElementById("dt-connection-search"),y=f.querySelector(".syndicate-button"),h=f.querySelector(".action-wrapper"),L=document.getElementById("dt-post-status"),T=document.getElementById("dt-as-draft");c.appendChild(f),(0,a.default)(c).hoverIntent(r,300,o),(0,a.default)(y).on("click",function(){if(!h.classList.contains("loading")){h.classList.add("loading");var n={action:"dt_push",nonce:s.dt.nonce,connections:d,postId:s.dt.postId};n.postStatus=null!==T&&T.checked?"draft":L.value;var r=!!s.dt.usexhr&&{withCredentials:!0};a.default.ajax({url:s.dt.ajaxurl,xhrFields:r,method:"post",data:n}).done(function(n){setTimeout(function(){if(h.classList.remove("loading"),!n.data||!n.data.results)return void e();t(n.data.results)},500)}).error(function(){setTimeout(function(){h.classList.remove("loading"),e()},500)})}}),(0,a.default)(f).on("click",".add-connection",function(e){if("A"!==e.target.nodeName&&(e.preventDefault(),!e.currentTarget.classList.contains("syndicated")))if(e.currentTarget.classList.contains("added")){var t=e.currentTarget.getAttribute("data-connection-type"),r=e.currentTarget.getAttribute("data-connection-id"),o=m.querySelector('[data-connection-id="'+r+'"][data-connection-type="'+t+'"]');o.parentNode.removeChild(o),delete d[t+r],Object.keys(d).length||p.classList.add("empty"),n()}else{var a=e.currentTarget.getAttribute("data-connection-type"),c=e.currentTarget.getAttribute("data-connection-id");d[a+c]=s.dtConnections[a+c],p.classList.remove("empty");var i=e.currentTarget.cloneNode();i.innerText=e.currentTarget.innerText;var u=document.createElement("span");u.classList.add("remove-connection"),i.appendChild(u),i.classList="added-connection",m.appendChild(i),n()}}),(0,a.default)(f).on("click",".remove-connection",function(e){e.currentTarget.parentNode.parentNode.removeChild(e.currentTarget.parentNode);var t=e.currentTarget.parentNode.getAttribute("data-connection-type"),r=e.currentTarget.parentNode.getAttribute("data-connection-id");delete d[t+r],Object.keys(d).length||p.classList.add("empty"),n()}),(0,a.default)(v).on("keyup change",i.default.debounce(function(e){""===e.currentTarget.value&&n(s.dtConnections),u=e.currentTarget.value.replace(/https?:\/\//i,"").replace(/www/i,"").replace(/[^0-9a-zA-Z ]+/,""),n()},300))}})}]); +!function(e){function t(a){if(n[a])return n[a].exports;var o=n[a]={i:a,l:!1,exports:{}};return e[a].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t){e.exports=jQuery},function(e,t){e.exports=window},function(e,t){e.exports=_},,,,function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var o=n(0),r=a(o),c=n(2),s=a(c),i=n(1),d={},u="",l=s.default.memoize(function(e){var t=document.getElementById(e);if(!t)return!1;var n={evaluate:/<#([\s\S]+?)#>/g,interpolate:/{{{([\s\S]+?)}}}/g,escape:/{{([^}]+?)}}(?!})/g};return s.default.template(t.innerHTML,null,n)});(0,r.default)(window).on("load",function(){function e(){g=p.querySelector(".connections-selected"),v=p.querySelector(".selected-connections-list"),h=p.querySelector(".new-connections-list"),y=document.getElementById("dt-connection-search"),L=p.querySelector(".action-wrapper"),T=document.getElementById("dt-post-status"),w=document.getElementById("dt-as-draft"),(0,r.default)(y).on("keyup change",s.default.debounce(function(e){""===e.currentTarget.value&&a(),u=e.currentTarget.value.replace(/https?:\/\//i,"").replace(/www/i,"").replace(/[^0-9a-zA-Z ]+/,""),a()},300))}function t(){p.classList.add("message-error"),setTimeout(function(){p.classList.remove("message-error")},6e3)}function n(e){var n=!1;s.default.each(e.internal,function(e,t){"fail"===e.status?n=!0:m["internal"+t].syndicated=e.url}),s.default.each(e.external,function(e,t){"fail"===e.status?n=!0:m["external"+t].syndicated=!0}),n?t():(p.classList.add("message-success"),g.classList.add("empty"),v.innerText="",setTimeout(function(){p.classList.remove("message-success")},6e3)),d={},a()}function a(){h.innerText="",s.default.each(m,function(e){if(""!==u){var t=e.name.replace(/[^0-9a-zA-Z ]+/,"").toLowerCase().match(u.toLowerCase()),n=e.url.replace(/https?:\/\//i,"").replace(/www/i,"").replace(/[^0-9a-zA-Z ]+/,"").toLowerCase().match(u.toLowerCase());if(!t&&!n)return}var a=l("dt-add-connection")({connection:e,selectedConnections:d});h.innerHTML+=a})}function o(){if(f.focus(),document.body.classList.toggle("distributor-show"),!p.classList.contains("loaded")){p.classList.remove("message-error"),p.classList.add("loaded");var t={action:"dt_load_connections",loadConnectionsNonce:i.dt.loadConnectionsNonce,postId:i.dt.postId},n=!!i.dt.usexhr&&{withCredentials:!0};r.default.ajax({url:i.dt.ajaxurl,xhrFields:n,method:"post",data:t}).done(function(t){if(!t.success||!t.data)return p.classList.remove("loaded"),void p.classList.add("message-error");m=t.data,p.innerHTML=l("dt-show-connections")({connections:m}),e()}).error(function(){p.classList.remove("loaded"),p.classList.add("message-error")})}}function c(){f.blur(),document.body.classList.toggle("distributor-show")}var f=document.querySelector("#wp-admin-bar-distributor"),p=document.querySelector("#distributor-push-wrapper");if(f&&p){var m="",g="",v="",h="",y="",L="",T="",w="";f.appendChild(p),(0,r.default)(f).hoverIntent(o,300,c),(0,r.default)(p).on("click",".syndicate-button",function(){if(!L.classList.contains("loading")){L.classList.add("loading");var e={action:"dt_push",nonce:i.dt.nonce,connections:d,postId:i.dt.postId};e.postStatus=null!==w&&w.checked?"draft":T.value;var a=!!i.dt.usexhr&&{withCredentials:!0};r.default.ajax({url:i.dt.ajaxurl,xhrFields:a,method:"post",data:e}).done(function(e){setTimeout(function(){if(L.classList.remove("loading"),!e.data||!e.data.results)return void t();n(e.data.results)},500)}).error(function(){setTimeout(function(){L.classList.remove("loading"),t()},500)})}}),(0,r.default)(p).on("click",".add-connection",function(e){if("A"!==e.target.nodeName&&(e.preventDefault(),!e.currentTarget.classList.contains("syndicated")))if(e.currentTarget.classList.contains("added")){var t=e.currentTarget.getAttribute("data-connection-type"),n=e.currentTarget.getAttribute("data-connection-id"),o=v.querySelector('[data-connection-id="'+n+'"][data-connection-type="'+t+'"]');o.parentNode.removeChild(o),delete d[t+n],Object.keys(d).length||g.classList.add("empty"),a()}else{var r=e.currentTarget.getAttribute("data-connection-type"),c=e.currentTarget.getAttribute("data-connection-id");d[r+c]=m[r+c],g.classList.remove("empty");var s=e.currentTarget.cloneNode();s.innerText=e.currentTarget.innerText;var i=document.createElement("span");i.classList.add("remove-connection"),s.appendChild(i),s.classList="added-connection",v.appendChild(s),a()}}),(0,r.default)(p).on("click",".remove-connection",function(e){e.currentTarget.parentNode.parentNode.removeChild(e.currentTarget.parentNode);var t=e.currentTarget.parentNode.getAttribute("data-connection-type"),n=e.currentTarget.parentNode.getAttribute("data-connection-id");delete d[t+n],Object.keys(d).length||g.classList.add("empty"),a()})}})}]); //# sourceMappingURL=push.min.js.map \ No newline at end of file diff --git a/dist/js/push.min.js.map b/dist/js/push.min.js.map index 9bca0aaf6..180cdb1bf 100644 --- a/dist/js/push.min.js.map +++ b/dist/js/push.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///push.min.js","webpack:///webpack/bootstrap fff10cbf8520b51427a4","webpack:///external \"jQuery\"","webpack:///external \"window\"","webpack:///external \"_\"","webpack:///./assets/js/push.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","window","_","_interopRequireDefault","obj","default","_jquery","_jquery2","_underscores","_underscores2","_window","selectedConnections","searchString","processTemplate","memoize","id","element","document","getElementById","options","evaluate","interpolate","escape","template","innerHTML","on","doError","distributorPushWrapper","classList","add","setTimeout","remove","doSuccess","results","error","each","internal","result","connectionId","status","dtConnections","syndicated","url","external","connectionsSelected","connectionsSelectedList","innerText","showConnections","connectionsNewList","connection","nameMatch","replace","toLowerCase","match","urlMatch","showConnection","distributorMenuEntered","distributorMenuItem","focus","body","toggle","distributorMenuExited","blur","querySelector","connectionsSearchInput","syndicateButton","actionWrapper","postStatusInput","asDraftInput","appendChild","hoverIntent","contains","data","action","nonce","dt","connections","postId","postStatus","checked","value","xhr","usexhr","withCredentials","ajax","ajaxurl","xhrFields","method","done","response","event","target","nodeName","preventDefault","currentTarget","type","getAttribute","deleteNode","parentNode","removeChild","keys","length","cloneNode","removeLink","createElement","debounce"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMM,SAAUtB,EAAQD,GEnExBC,EAAAD,QAAAwB,QFyEM,SAAUvB,EAAQD,GGzExBC,EAAAD,QAAAyB,QH+EM,SAAUxB,EAAQD,GI/ExBC,EAAAD,QAAA0B,GJoFO,CACA,CACA,CAED,SAAUzB,EAAQD,EAASH,GAEjC,YAaA,SAAS8B,GAAuBC,GAAO,MAAOA,IAAOA,EAAIX,WAAaW,GAAQC,QAASD,GKvGvF,GAAAE,GAAAjC,EAAA,GL+FIkC,EAAWJ,EAAuBG,GK9FtCE,EAAA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AAWF,aAAc,wBACpDjF,EAAO2E,EAAMI,cAAcI,WAAWF,aAAc,4BAEnDrF,GAAoBoF,EAAOhF,GAE3B5B,OAAOiH,KAAMzF,GAAsB0F,QACzCzD,EAAoBhB,UAAUC,IAAK,SAGpCkB,OAMD,EAAAxC,EAAAF,SAAQ2D,GAAyBvC,GAAI,eAAgBhB,EAAAJ,QAAEoG,SAAU,SAAEf,GAC7D,KAAOA,EAAMI,cAAcd,OAC/BjC,mBAGDnC,EAAe8E,EAAMI,cAAcd,MAAM7B,QAAS,eAAgB,IAAKA,QAAS,OAAQ,IAAKA,QAAS,iBAAkB,IAExHJ,KACE","file":"push.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 6);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = _;\n\n/***/ }),\n/* 3 */,\n/* 4 */,\n/* 5 */,\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nvar _underscores = __webpack_require__(2);\n\nvar _underscores2 = _interopRequireDefault(_underscores);\n\nvar _window = __webpack_require__(1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar selectedConnections = {},\n searchString = '';\n\nvar processTemplate = _underscores2.default.memoize(function (id) {\n\tvar element = document.getElementById(id);\n\tif (!element) {\n\t\treturn false;\n\t}\n\n\t// Use WordPress style Backbone template syntax\n\tvar options = {\n\t\tevaluate: /<#([\\s\\S]+?)#>/g,\n\t\tinterpolate: /{{{([\\s\\S]+?)}}}/g,\n\t\tescape: /{{([^}]+?)}}(?!})/g\n\t};\n\n\treturn _underscores2.default.template(element.innerHTML, null, options);\n});\n\n(0, _jquery2.default)(window).on('load', function () {\n\tvar distributorMenuItem = document.querySelector('#wp-admin-bar-distributor');\n\tvar distributorPushWrapper = document.querySelector('#distributor-push-wrapper');\n\n\tif (!distributorMenuItem || !distributorPushWrapper) {\n\t\treturn;\n\t}\n\n\tvar connectionsSelected = distributorPushWrapper.querySelector('.connections-selected');\n\tvar connectionsSelectedList = distributorPushWrapper.querySelector('.selected-connections-list');\n\tvar connectionsNewList = distributorPushWrapper.querySelector('.new-connections-list');\n\tvar connectionsSearchInput = document.getElementById('dt-connection-search');\n\tvar syndicateButton = distributorPushWrapper.querySelector('.syndicate-button');\n\tvar actionWrapper = distributorPushWrapper.querySelector('.action-wrapper');\n\tvar postStatusInput = document.getElementById('dt-post-status');\n\tvar asDraftInput = document.getElementById('dt-as-draft');\n\n\tdistributorMenuItem.appendChild(distributorPushWrapper);\n\n\t/**\n \t * Handle UI error changes\n \t */\n\tfunction doError() {\n\t\tdistributorPushWrapper.classList.add('message-error');\n\n\t\tsetTimeout(function () {\n\t\t\tdistributorPushWrapper.classList.remove('message-error');\n\t\t}, 6000);\n\t}\n\n\t/**\n * Handle UI success changes\n */\n\tfunction doSuccess(results) {\n\t\tvar error = false;\n\n\t\t_underscores2.default.each(results.internal, function (result, connectionId) {\n\t\t\tif ('fail' === result.status) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\t_window.dtConnections['internal' + connectionId].syndicated = result.url;\n\t\t\t}\n\t\t});\n\n\t\t_underscores2.default.each(results.external, function (result, connectionId) {\n\t\t\tif ('fail' === result.status) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\t_window.dtConnections['external' + connectionId].syndicated = true;\n\t\t\t}\n\t\t});\n\n\t\tif (error) {\n\t\t\tdoError();\n\t\t} else {\n\t\t\tdistributorPushWrapper.classList.add('message-success');\n\n\t\t\tconnectionsSelected.classList.add('empty');\n\t\t\tconnectionsSelectedList.innerText = '';\n\n\t\t\tsetTimeout(function () {\n\t\t\t\tdistributorPushWrapper.classList.remove('message-success');\n\t\t\t}, 6000);\n\t\t}\n\n\t\tselectedConnections = {};\n\n\t\tshowConnections();\n\t}\n\n\t/**\n \t * Show connections. If there is a search string, then filter by it\n \t */\n\tfunction showConnections() {\n\t\tconnectionsNewList.innerText = '';\n\n\t\t_underscores2.default.each(_window.dtConnections, function (connection) {\n\t\t\tif ('' !== searchString) {\n\t\t\t\tvar nameMatch = connection.name.replace(/[^0-9a-zA-Z ]+/, '').toLowerCase().match(searchString.toLowerCase());\n\t\t\t\tvar urlMatch = connection.url.replace(/https?:\\/\\//i, '').replace(/www/i, '').replace(/[^0-9a-zA-Z ]+/, '').toLowerCase().match(searchString.toLowerCase());\n\n\t\t\t\tif (!nameMatch && !urlMatch) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar showConnection = processTemplate('dt-add-connection')({\n\t\t\t\tconnection: connection,\n\t\t\t\tselectedConnections: selectedConnections\n\t\t\t});\n\n\t\t\tconnectionsNewList.innerHTML += showConnection;\n\t\t});\n\t}\n\n\t/**\n * Handle distributor push dropdown menu hover using hoverIntent.\n */\n\tfunction distributorMenuEntered() {\n\t\tdistributorMenuItem.focus();\n\t\tdocument.body.classList.toggle('distributor-show');\n\t}\n\n\t/**\n * Handle exiting the distributor menu.\n */\n\tfunction distributorMenuExited() {\n\t\tdistributorMenuItem.blur();\n\t\tdocument.body.classList.toggle('distributor-show');\n\t}\n\n\t(0, _jquery2.default)(distributorMenuItem).hoverIntent(distributorMenuEntered, 300, distributorMenuExited);\n\n\t/**\n * Do syndication ajax\n */\n\t(0, _jquery2.default)(syndicateButton).on('click', function () {\n\t\tif (actionWrapper.classList.contains('loading')) {\n\t\t\treturn;\n\t\t}\n\n\t\tactionWrapper.classList.add('loading');\n\n\t\tvar data = {\n\t\t\taction: 'dt_push',\n\t\t\tnonce: _window.dt.nonce,\n\t\t\tconnections: selectedConnections,\n\t\t\tpostId: _window.dt.postId\n\t\t};\n\n\t\tdata.postStatus = null !== asDraftInput && asDraftInput.checked ? 'draft' : postStatusInput.value;\n\n\t\tvar xhr = _window.dt.usexhr ? { withCredentials: true } : false;\n\n\t\t_jquery2.default.ajax({\n\t\t\turl: _window.dt.ajaxurl,\n\t\t\txhrFields: xhr,\n\t\t\tmethod: 'post',\n\t\t\tdata: data\n\t\t}).done(function (response) {\n\t\t\tsetTimeout(function () {\n\t\t\t\tactionWrapper.classList.remove('loading');\n\n\t\t\t\tif (!response.data || !response.data.results) {\n\t\t\t\t\tdoError();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdoSuccess(response.data.results);\n\t\t\t}, 500);\n\t\t}).error(function () {\n\t\t\tsetTimeout(function () {\n\t\t\t\tactionWrapper.classList.remove('loading');\n\n\t\t\t\tdoError();\n\t\t\t}, 500);\n\t\t});\n\t});\n\n\t/**\n * Add a connection to selected connections for ajax and to the UI list.\n */\n\t(0, _jquery2.default)(distributorPushWrapper).on('click', '.add-connection', function (event) {\n\t\tif ('A' === event.target.nodeName) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tif (event.currentTarget.classList.contains('syndicated')) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (event.currentTarget.classList.contains('added')) {\n\n\t\t\tvar type = event.currentTarget.getAttribute('data-connection-type');\n\t\t\tvar id = event.currentTarget.getAttribute('data-connection-id');\n\n\t\t\tvar deleteNode = connectionsSelectedList.querySelector('[data-connection-id=\"' + id + '\"][data-connection-type=\"' + type + '\"]');\n\n\t\t\tdeleteNode.parentNode.removeChild(deleteNode);\n\n\t\t\tdelete selectedConnections[type + id];\n\n\t\t\tif (!Object.keys(selectedConnections).length) {\n\t\t\t\tconnectionsSelected.classList.add('empty');\n\t\t\t}\n\n\t\t\tshowConnections();\n\t\t} else {\n\n\t\t\tvar _type = event.currentTarget.getAttribute('data-connection-type');\n\t\t\tvar _id = event.currentTarget.getAttribute('data-connection-id');\n\n\t\t\tselectedConnections[_type + _id] = _window.dtConnections[_type + _id];\n\n\t\t\tconnectionsSelected.classList.remove('empty');\n\n\t\t\tvar element = event.currentTarget.cloneNode();\n\t\t\telement.innerText = event.currentTarget.innerText;\n\n\t\t\tvar removeLink = document.createElement('span');\n\t\t\tremoveLink.classList.add('remove-connection');\n\n\t\t\telement.appendChild(removeLink);\n\t\t\telement.classList = 'added-connection';\n\n\t\t\tconnectionsSelectedList.appendChild(element);\n\n\t\t\tshowConnections();\n\t\t}\n\t});\n\n\t/**\n * Remove a connection from selected connections and the UI list\n */\n\t(0, _jquery2.default)(distributorPushWrapper).on('click', '.remove-connection', function (event) {\n\t\tevent.currentTarget.parentNode.parentNode.removeChild(event.currentTarget.parentNode);\n\t\tvar type = event.currentTarget.parentNode.getAttribute('data-connection-type');\n\t\tvar id = event.currentTarget.parentNode.getAttribute('data-connection-id');\n\n\t\tdelete selectedConnections[type + id];\n\n\t\tif (!Object.keys(selectedConnections).length) {\n\t\t\tconnectionsSelected.classList.add('empty');\n\t\t}\n\n\t\tshowConnections();\n\t});\n\n\t/**\n * List for connection filtering\n */\n\t(0, _jquery2.default)(connectionsSearchInput).on('keyup change', _underscores2.default.debounce(function (event) {\n\t\tif ('' === event.currentTarget.value) {\n\t\t\tshowConnections(_window.dtConnections);\n\t\t}\n\n\t\tsearchString = event.currentTarget.value.replace(/https?:\\/\\//i, '').replace(/www/i, '').replace(/[^0-9a-zA-Z ]+/, '');\n\n\t\tshowConnections();\n\t}, 300));\n});\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// push.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fff10cbf8520b51427a4","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","module.exports = _;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"_\"\n// module id = 2\n// module chunks = 0 1","import jQuery from 'jquery';\nimport _ from 'underscores';\nimport { dt, dtConnections } from 'window';\n\nlet selectedConnections = {},\n\tsearchString = '';\n\nconst processTemplate = _.memoize( ( id ) => {\n\tconst element = document.getElementById( id );\n\tif ( ! element ) {\n\t\treturn false;\n\t}\n\n\t// Use WordPress style Backbone template syntax\n\tconst options = {\n\t\tevaluate: /<#([\\s\\S]+?)#>/g,\n\t\tinterpolate: /{{{([\\s\\S]+?)}}}/g,\n\t\tescape: /{{([^}]+?)}}(?!})/g\n\t};\n\n\treturn _.template( element.innerHTML, null, options );\n} );\n\njQuery( window ).on( 'load', () => {\n\tconst distributorMenuItem = document.querySelector( '#wp-admin-bar-distributor' );\n\tconst distributorPushWrapper = document.querySelector( '#distributor-push-wrapper' );\n\n\tif ( ! distributorMenuItem || ! distributorPushWrapper ) {\n\t\treturn;\n\t}\n\n\tconst connectionsSelected = distributorPushWrapper.querySelector( '.connections-selected' );\n\tconst connectionsSelectedList = distributorPushWrapper.querySelector( '.selected-connections-list' );\n\tconst connectionsNewList = distributorPushWrapper.querySelector( '.new-connections-list' );\n\tconst connectionsSearchInput = document.getElementById( 'dt-connection-search' );\n\tconst syndicateButton = distributorPushWrapper.querySelector( '.syndicate-button' );\n\tconst actionWrapper = distributorPushWrapper.querySelector( '.action-wrapper' );\n\tconst postStatusInput = document.getElementById( 'dt-post-status' );\n\tconst asDraftInput = document.getElementById( 'dt-as-draft' );\n\n\tdistributorMenuItem.appendChild( distributorPushWrapper );\n\n\t/**\n\t\t * Handle UI error changes\n\t\t */\n\tfunction doError() {\n\t\tdistributorPushWrapper.classList.add( 'message-error' );\n\n\t\tsetTimeout( () => {\n\t\t\tdistributorPushWrapper.classList.remove( 'message-error' );\n\t\t}, 6000 );\n\t}\n\n\t/**\n\t * Handle UI success changes\n\t */\n\tfunction doSuccess( results ) {\n\t\tlet error = false;\n\n\t\t_.each( results.internal, ( result, connectionId ) => {\n\t\t\tif ( 'fail' === result.status ) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\tdtConnections['internal' + connectionId].syndicated = result.url;\n\t\t\t}\n\t\t} );\n\n\t\t_.each( results.external, ( result, connectionId ) => {\n\t\t\tif ( 'fail' === result.status ) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\tdtConnections['external' + connectionId].syndicated = true;\n\t\t\t}\n\t\t} );\n\n\t\tif ( error ) {\n\t\t\tdoError();\n\t\t} else {\n\t\t\tdistributorPushWrapper.classList.add( 'message-success' );\n\n\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t\tconnectionsSelectedList.innerText = '';\n\n\t\t\tsetTimeout( () => {\n\t\t\t\tdistributorPushWrapper.classList.remove( 'message-success' );\n\t\t\t}, 6000 );\n\t\t}\n\n\t\tselectedConnections = {};\n\n\t\tshowConnections();\n\t}\n\n\t/**\n\t\t * Show connections. If there is a search string, then filter by it\n\t\t */\n\tfunction showConnections() {\n\t\tconnectionsNewList.innerText = '';\n\n\t\t_.each( dtConnections, ( connection ) => {\n\t\t\tif ( '' !== searchString ) {\n\t\t\t\tlet nameMatch = connection.name.replace( /[^0-9a-zA-Z ]+/, '' ).toLowerCase().match( searchString.toLowerCase() );\n\t\t\t\tlet urlMatch = connection.url.replace( /https?:\\/\\//i, '' ).replace( /www/i, '' ).replace( /[^0-9a-zA-Z ]+/, '' ).toLowerCase().match( searchString.toLowerCase() );\n\n\t\t\t\tif ( ! nameMatch && ! urlMatch ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst showConnection = processTemplate( 'dt-add-connection' )( {\n\t\t\t\tconnection: connection,\n\t\t\t\tselectedConnections: selectedConnections\n\t\t\t} );\n\n\t\t\tconnectionsNewList.innerHTML += showConnection;\n\t\t} );\n\t}\n\n\t/**\n\t * Handle distributor push dropdown menu hover using hoverIntent.\n\t */\n\tfunction distributorMenuEntered() {\n\t\tdistributorMenuItem.focus();\n\t\tdocument.body.classList.toggle( 'distributor-show' );\n\t}\n\n\t/**\n\t * Handle exiting the distributor menu.\n\t */\n\tfunction distributorMenuExited() {\n\t\tdistributorMenuItem.blur();\n\t\tdocument.body.classList.toggle( 'distributor-show' );\n\t}\n\n\tjQuery( distributorMenuItem ).hoverIntent( distributorMenuEntered, 300, distributorMenuExited );\n\n\t/**\n\t * Do syndication ajax\n\t */\n\tjQuery( syndicateButton ).on( 'click', () => {\n\t\tif ( actionWrapper.classList.contains( 'loading' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tactionWrapper.classList.add( 'loading' );\n\n\t\tconst data = {\n\t\t\taction: 'dt_push',\n\t\t\tnonce: dt.nonce,\n\t\t\tconnections: selectedConnections,\n\t\t\tpostId: dt.postId\n\t\t};\n\n\t\tdata.postStatus = ( null !== asDraftInput && asDraftInput.checked ) ? 'draft' : postStatusInput.value;\n\n\t\tconst xhr = dt.usexhr ? { withCredentials: true } : false;\n\n\t\tjQuery.ajax( {\n\t\t\turl: dt.ajaxurl,\n\t\t\txhrFields: xhr,\n\t\t\tmethod: 'post',\n\t\t\tdata: data\n\t\t} ).done( ( response ) => {\n\t\t\tsetTimeout( () => {\n\t\t\t\tactionWrapper.classList.remove( 'loading' );\n\n\t\t\t\tif ( ! response.data || ! response.data.results ) {\n\t\t\t\t\tdoError();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdoSuccess( response.data.results );\n\t\t\t}, 500 );\n\t\t} ).error( () => {\n\t\t\tsetTimeout( () => {\n\t\t\t\tactionWrapper.classList.remove( 'loading' );\n\n\t\t\t\tdoError();\n\t\t\t}, 500 );\n\t\t} );\n\t} );\n\n\t/**\n\t * Add a connection to selected connections for ajax and to the UI list.\n\t */\n\tjQuery( distributorPushWrapper ).on( 'click', '.add-connection', ( event ) => {\n\t\tif ( 'A' === event.target.nodeName ) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tif ( event.currentTarget.classList.contains( 'syndicated' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( event.currentTarget.classList.contains( 'added' ) ) {\n\n\t\t\tconst type = event.currentTarget.getAttribute( 'data-connection-type' );\n\t\t\tconst id = event.currentTarget.getAttribute( 'data-connection-id' );\n\n\t\t\tconst deleteNode = connectionsSelectedList.querySelector( '[data-connection-id=\"' + id + '\"][data-connection-type=\"' + type + '\"]' );\n\n\t\t\tdeleteNode.parentNode.removeChild( deleteNode );\n\n\t\t\tdelete selectedConnections[type + id];\n\n\t\t\tif ( ! Object.keys( selectedConnections ).length ) {\n\t\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t\t}\n\n\t\t\tshowConnections();\n\t\t} else {\n\n\t\t\tconst type = event.currentTarget.getAttribute( 'data-connection-type' );\n\t\t\tconst id = event.currentTarget.getAttribute( 'data-connection-id' );\n\n\t\t\tselectedConnections[type + id] = dtConnections[type + id];\n\n\t\t\tconnectionsSelected.classList.remove( 'empty' );\n\n\t\t\tconst element = event.currentTarget.cloneNode();\n\t\t\telement.innerText = event.currentTarget.innerText;\n\n\t\t\tconst removeLink = document.createElement( 'span' );\n\t\t\tremoveLink.classList.add( 'remove-connection' );\n\n\t\t\telement.appendChild( removeLink );\n\t\t\telement.classList = 'added-connection';\n\n\t\t\tconnectionsSelectedList.appendChild( element );\n\n\t\t\tshowConnections();\n\t\t}\n\t} );\n\n\t/**\n\t * Remove a connection from selected connections and the UI list\n\t */\n\tjQuery( distributorPushWrapper ).on( 'click', '.remove-connection', ( event ) => {\n\t\tevent.currentTarget.parentNode.parentNode.removeChild( event.currentTarget.parentNode );\n\t\tconst type = event.currentTarget.parentNode.getAttribute( 'data-connection-type' );\n\t\tconst id = event.currentTarget.parentNode.getAttribute( 'data-connection-id' );\n\n\t\tdelete selectedConnections[type + id];\n\n\t\tif ( ! Object.keys( selectedConnections ).length ) {\n\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t}\n\n\t\tshowConnections();\n\t} );\n\n\t/**\n\t * List for connection filtering\n\t */\n\tjQuery( connectionsSearchInput ).on( 'keyup change', _.debounce( ( event ) => {\n\t\tif ( '' === event.currentTarget.value ) {\n\t\t\tshowConnections( dtConnections );\n\t\t}\n\n\t\tsearchString = event.currentTarget.value.replace( /https?:\\/\\//i, '' ).replace( /www/i, '' ).replace( /[^0-9a-zA-Z ]+/, '' );\n\n\t\tshowConnections();\n\t}, 300 ) );\n} );\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/push.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///push.min.js","webpack:///webpack/bootstrap dc0891300b56d8a91118","webpack:///external \"jQuery\"","webpack:///external \"window\"","webpack:///external \"_\"","webpack:///./assets/js/push.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","window","_","_interopRequireDefault","obj","default","_jquery","_jquery2","_underscores","_underscores2","_window","selectedConnections","searchString","processTemplate","memoize","id","element","document","getElementById","options","evaluate","interpolate","escape","template","innerHTML","on","setVariables","connectionsSelected","distributorPushWrapper","querySelector","connectionsSelectedList","connectionsNewList","connectionsSearchInput","actionWrapper","postStatusInput","asDraftInput","debounce","event","currentTarget","value","showConnections","replace","doError","classList","add","setTimeout","remove","doSuccess","results","error","each","internal","result","connectionId","status","dtConnections","syndicated","url","external","innerText","connection","nameMatch","toLowerCase","match","urlMatch","showConnection","distributorMenuEntered","distributorMenuItem","focus","body","toggle","contains","data","action","loadConnectionsNonce","dt","postId","xhr","usexhr","withCredentials","ajax","ajaxurl","xhrFields","method","done","response","success","connections","distributorMenuExited","blur","appendChild","hoverIntent","nonce","postStatus","checked","target","nodeName","preventDefault","type","getAttribute","deleteNode","parentNode","removeChild","keys","length","cloneNode","removeLink","createElement"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GA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,QACM,CAEN,GAAM0D,GAAO7D,EAAMC,cAAc6D,aAAc,wBACzCpF,EAAOsB,EAAMC,cAAc6D,aAAc,qBAE/CxF,GAAoBuF,EAAOnF,GAAMwC,EAAc2C,EAAOnF,GAEtDY,EAAoBgB,UAAUG,OAAQ,QAEtC,IAAM9B,GAAgBqB,EAAMC,cAAcmE,WAC1CzF,GAAQ2C,UAAYtB,EAAMC,cAAcqB,SAExC,IAAM+C,GAAazF,SAAS0F,cAAe,OAC3CD,GAAW/D,UAAUC,IAAK,qBAE1B5B,EAAQ0E,YAAagB,GACrB1F,EAAQ2B,UAAY,mBAEpBb,EAAwB4D,YAAa1E,GAErCwB,QAOF,EAAAjC,EAAAF,SAAQuB,GAAyBH,GAAI,QAAS,qBAAsB,SAAEY,GACrEA,EAAMC,cAAc+D,WAAWA,WAAWC,YAAajE,EAAMC,cAAc+D,WAC3E,IAAMH,GAAO7D,EAAMC,cAAc+D,WAAWF,aAAc,wBACpDpF,EAAOsB,EAAMC,cAAc+D,WAAWF,aAAc,4BAEnDxF,GAAoBuF,EAAOnF,GAE3B5B,OAAOoH,KAAM5F,GAAsB6F,QACzC7E,EAAoBgB,UAAUC,IAAK,SAGpCJ","file":"push.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 6);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = _;\n\n/***/ }),\n/* 3 */,\n/* 4 */,\n/* 5 */,\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nvar _underscores = __webpack_require__(2);\n\nvar _underscores2 = _interopRequireDefault(_underscores);\n\nvar _window = __webpack_require__(1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar selectedConnections = {},\n searchString = '';\n\nvar processTemplate = _underscores2.default.memoize(function (id) {\n\tvar element = document.getElementById(id);\n\tif (!element) {\n\t\treturn false;\n\t}\n\n\t// Use WordPress style Backbone template syntax\n\tvar options = {\n\t\tevaluate: /<#([\\s\\S]+?)#>/g,\n\t\tinterpolate: /{{{([\\s\\S]+?)}}}/g,\n\t\tescape: /{{([^}]+?)}}(?!})/g\n\t};\n\n\treturn _underscores2.default.template(element.innerHTML, null, options);\n});\n\n(0, _jquery2.default)(window).on('load', function () {\n\tvar distributorMenuItem = document.querySelector('#wp-admin-bar-distributor');\n\tvar distributorPushWrapper = document.querySelector('#distributor-push-wrapper');\n\n\tif (!distributorMenuItem || !distributorPushWrapper) {\n\t\treturn;\n\t}\n\n\tvar dtConnections = '';\n\tvar connectionsSelected = '';\n\tvar connectionsSelectedList = '';\n\tvar connectionsNewList = '';\n\tvar connectionsSearchInput = '';\n\tvar actionWrapper = '';\n\tvar postStatusInput = '';\n\tvar asDraftInput = '';\n\n\tdistributorMenuItem.appendChild(distributorPushWrapper);\n\n\t/**\n * Set variables after connections have been rendered\n */\n\tfunction setVariables() {\n\t\tconnectionsSelected = distributorPushWrapper.querySelector('.connections-selected');\n\t\tconnectionsSelectedList = distributorPushWrapper.querySelector('.selected-connections-list');\n\t\tconnectionsNewList = distributorPushWrapper.querySelector('.new-connections-list');\n\t\tconnectionsSearchInput = document.getElementById('dt-connection-search');\n\t\tactionWrapper = distributorPushWrapper.querySelector('.action-wrapper');\n\t\tpostStatusInput = document.getElementById('dt-post-status');\n\t\tasDraftInput = document.getElementById('dt-as-draft');\n\n\t\t/**\n * Listen for connection filtering\n */\n\t\t(0, _jquery2.default)(connectionsSearchInput).on('keyup change', _underscores2.default.debounce(function (event) {\n\t\t\tif ('' === event.currentTarget.value) {\n\t\t\t\tshowConnections(dtConnections);\n\t\t\t}\n\n\t\t\tsearchString = event.currentTarget.value.replace(/https?:\\/\\//i, '').replace(/www/i, '').replace(/[^0-9a-zA-Z ]+/, '');\n\n\t\t\tshowConnections();\n\t\t}, 300));\n\t}\n\n\t/**\n * Handle UI error changes\n */\n\tfunction doError() {\n\t\tdistributorPushWrapper.classList.add('message-error');\n\n\t\tsetTimeout(function () {\n\t\t\tdistributorPushWrapper.classList.remove('message-error');\n\t\t}, 6000);\n\t}\n\n\t/**\n * Handle UI success changes\n */\n\tfunction doSuccess(results) {\n\t\tvar error = false;\n\n\t\t_underscores2.default.each(results.internal, function (result, connectionId) {\n\t\t\tif ('fail' === result.status) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\tdtConnections['internal' + connectionId].syndicated = result.url;\n\t\t\t}\n\t\t});\n\n\t\t_underscores2.default.each(results.external, function (result, connectionId) {\n\t\t\tif ('fail' === result.status) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\tdtConnections['external' + connectionId].syndicated = true;\n\t\t\t}\n\t\t});\n\n\t\tif (error) {\n\t\t\tdoError();\n\t\t} else {\n\t\t\tdistributorPushWrapper.classList.add('message-success');\n\n\t\t\tconnectionsSelected.classList.add('empty');\n\t\t\tconnectionsSelectedList.innerText = '';\n\n\t\t\tsetTimeout(function () {\n\t\t\t\tdistributorPushWrapper.classList.remove('message-success');\n\t\t\t}, 6000);\n\t\t}\n\n\t\tselectedConnections = {};\n\n\t\tshowConnections();\n\t}\n\n\t/**\n \t * Show connections. If there is a search string, then filter by it\n \t */\n\tfunction showConnections() {\n\t\tconnectionsNewList.innerText = '';\n\n\t\t_underscores2.default.each(dtConnections, function (connection) {\n\t\t\tif ('' !== searchString) {\n\t\t\t\tvar nameMatch = connection.name.replace(/[^0-9a-zA-Z ]+/, '').toLowerCase().match(searchString.toLowerCase());\n\t\t\t\tvar urlMatch = connection.url.replace(/https?:\\/\\//i, '').replace(/www/i, '').replace(/[^0-9a-zA-Z ]+/, '').toLowerCase().match(searchString.toLowerCase());\n\n\t\t\t\tif (!nameMatch && !urlMatch) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar showConnection = processTemplate('dt-add-connection')({\n\t\t\t\tconnection: connection,\n\t\t\t\tselectedConnections: selectedConnections\n\t\t\t});\n\n\t\t\tconnectionsNewList.innerHTML += showConnection;\n\t\t});\n\t}\n\n\t/**\n * Handle distributor push dropdown menu hover using hoverIntent.\n */\n\tfunction distributorMenuEntered() {\n\t\tdistributorMenuItem.focus();\n\t\tdocument.body.classList.toggle('distributor-show');\n\n\t\tif (distributorPushWrapper.classList.contains('loaded')) {\n\t\t\treturn;\n\t\t}\n\n\t\tdistributorPushWrapper.classList.remove('message-error');\n\t\tdistributorPushWrapper.classList.add('loaded');\n\n\t\tvar data = {\n\t\t\taction: 'dt_load_connections',\n\t\t\tloadConnectionsNonce: _window.dt.loadConnectionsNonce,\n\t\t\tpostId: _window.dt.postId\n\t\t};\n\n\t\tvar xhr = _window.dt.usexhr ? { withCredentials: true } : false;\n\n\t\t_jquery2.default.ajax({\n\t\t\turl: _window.dt.ajaxurl,\n\t\t\txhrFields: xhr,\n\t\t\tmethod: 'post',\n\t\t\tdata: data\n\t\t}).done(function (response) {\n\t\t\tif (!response.success || !response.data) {\n\t\t\t\tdistributorPushWrapper.classList.remove('loaded');\n\t\t\t\tdistributorPushWrapper.classList.add('message-error');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdtConnections = response.data;\n\n\t\t\t// Allowing innerHTML because processTemplate escapes values\n\t\t\tdistributorPushWrapper.innerHTML = processTemplate('dt-show-connections')({\n\t\t\t\tconnections: dtConnections\n\t\t\t});\n\n\t\t\tsetVariables();\n\t\t}).error(function () {\n\t\t\tdistributorPushWrapper.classList.remove('loaded');\n\t\t\tdistributorPushWrapper.classList.add('message-error');\n\t\t});\n\t}\n\n\t/**\n * Handle exiting the distributor menu.\n */\n\tfunction distributorMenuExited() {\n\t\tdistributorMenuItem.blur();\n\t\tdocument.body.classList.toggle('distributor-show');\n\t}\n\n\t(0, _jquery2.default)(distributorMenuItem).hoverIntent(distributorMenuEntered, 300, distributorMenuExited);\n\n\t/**\n * Do syndication ajax\n */\n\t(0, _jquery2.default)(distributorPushWrapper).on('click', '.syndicate-button', function () {\n\t\tif (actionWrapper.classList.contains('loading')) {\n\t\t\treturn;\n\t\t}\n\n\t\tactionWrapper.classList.add('loading');\n\n\t\tvar data = {\n\t\t\taction: 'dt_push',\n\t\t\tnonce: _window.dt.nonce,\n\t\t\tconnections: selectedConnections,\n\t\t\tpostId: _window.dt.postId\n\t\t};\n\n\t\tdata.postStatus = null !== asDraftInput && asDraftInput.checked ? 'draft' : postStatusInput.value;\n\n\t\tvar xhr = _window.dt.usexhr ? { withCredentials: true } : false;\n\n\t\t_jquery2.default.ajax({\n\t\t\turl: _window.dt.ajaxurl,\n\t\t\txhrFields: xhr,\n\t\t\tmethod: 'post',\n\t\t\tdata: data\n\t\t}).done(function (response) {\n\t\t\tsetTimeout(function () {\n\t\t\t\tactionWrapper.classList.remove('loading');\n\n\t\t\t\tif (!response.data || !response.data.results) {\n\t\t\t\t\tdoError();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdoSuccess(response.data.results);\n\t\t\t}, 500);\n\t\t}).error(function () {\n\t\t\tsetTimeout(function () {\n\t\t\t\tactionWrapper.classList.remove('loading');\n\n\t\t\t\tdoError();\n\t\t\t}, 500);\n\t\t});\n\t});\n\n\t/**\n * Add a connection to selected connections for ajax and to the UI list.\n */\n\t(0, _jquery2.default)(distributorPushWrapper).on('click', '.add-connection', function (event) {\n\t\tif ('A' === event.target.nodeName) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tif (event.currentTarget.classList.contains('syndicated')) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (event.currentTarget.classList.contains('added')) {\n\n\t\t\tvar type = event.currentTarget.getAttribute('data-connection-type');\n\t\t\tvar id = event.currentTarget.getAttribute('data-connection-id');\n\n\t\t\tvar deleteNode = connectionsSelectedList.querySelector('[data-connection-id=\"' + id + '\"][data-connection-type=\"' + type + '\"]');\n\n\t\t\tdeleteNode.parentNode.removeChild(deleteNode);\n\n\t\t\tdelete selectedConnections[type + id];\n\n\t\t\tif (!Object.keys(selectedConnections).length) {\n\t\t\t\tconnectionsSelected.classList.add('empty');\n\t\t\t}\n\n\t\t\tshowConnections();\n\t\t} else {\n\n\t\t\tvar _type = event.currentTarget.getAttribute('data-connection-type');\n\t\t\tvar _id = event.currentTarget.getAttribute('data-connection-id');\n\n\t\t\tselectedConnections[_type + _id] = dtConnections[_type + _id];\n\n\t\t\tconnectionsSelected.classList.remove('empty');\n\n\t\t\tvar element = event.currentTarget.cloneNode();\n\t\t\telement.innerText = event.currentTarget.innerText;\n\n\t\t\tvar removeLink = document.createElement('span');\n\t\t\tremoveLink.classList.add('remove-connection');\n\n\t\t\telement.appendChild(removeLink);\n\t\t\telement.classList = 'added-connection';\n\n\t\t\tconnectionsSelectedList.appendChild(element);\n\n\t\t\tshowConnections();\n\t\t}\n\t});\n\n\t/**\n * Remove a connection from selected connections and the UI list\n */\n\t(0, _jquery2.default)(distributorPushWrapper).on('click', '.remove-connection', function (event) {\n\t\tevent.currentTarget.parentNode.parentNode.removeChild(event.currentTarget.parentNode);\n\t\tvar type = event.currentTarget.parentNode.getAttribute('data-connection-type');\n\t\tvar id = event.currentTarget.parentNode.getAttribute('data-connection-id');\n\n\t\tdelete selectedConnections[type + id];\n\n\t\tif (!Object.keys(selectedConnections).length) {\n\t\t\tconnectionsSelected.classList.add('empty');\n\t\t}\n\n\t\tshowConnections();\n\t});\n});\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// push.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap dc0891300b56d8a91118","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","module.exports = _;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"_\"\n// module id = 2\n// module chunks = 0 1","import jQuery from 'jquery';\nimport _ from 'underscores';\nimport { dt } from 'window';\n\nlet selectedConnections = {},\n\tsearchString = '';\n\nconst processTemplate = _.memoize( ( id ) => {\n\tconst element = document.getElementById( id );\n\tif ( ! element ) {\n\t\treturn false;\n\t}\n\n\t// Use WordPress style Backbone template syntax\n\tconst options = {\n\t\tevaluate: /<#([\\s\\S]+?)#>/g,\n\t\tinterpolate: /{{{([\\s\\S]+?)}}}/g,\n\t\tescape: /{{([^}]+?)}}(?!})/g\n\t};\n\n\treturn _.template( element.innerHTML, null, options );\n} );\n\njQuery( window ).on( 'load', () => {\n\tconst distributorMenuItem = document.querySelector( '#wp-admin-bar-distributor' );\n\tconst distributorPushWrapper = document.querySelector( '#distributor-push-wrapper' );\n\n\tif ( ! distributorMenuItem || ! distributorPushWrapper ) {\n\t\treturn;\n\t}\n\n\tlet dtConnections = '';\n\tlet connectionsSelected = '';\n\tlet connectionsSelectedList = '';\n\tlet connectionsNewList = '';\n\tlet connectionsSearchInput = '';\n\tlet actionWrapper = '';\n\tlet postStatusInput = '';\n\tlet asDraftInput = '';\n\n\tdistributorMenuItem.appendChild( distributorPushWrapper );\n\n\t/**\n\t * Set variables after connections have been rendered\n\t */\n\tfunction setVariables() {\n\t\tconnectionsSelected = distributorPushWrapper.querySelector( '.connections-selected' );\n\t\tconnectionsSelectedList = distributorPushWrapper.querySelector( '.selected-connections-list' );\n\t\tconnectionsNewList = distributorPushWrapper.querySelector( '.new-connections-list' );\n\t\tconnectionsSearchInput = document.getElementById( 'dt-connection-search' );\n\t\tactionWrapper = distributorPushWrapper.querySelector( '.action-wrapper' );\n\t\tpostStatusInput = document.getElementById( 'dt-post-status' );\n\t\tasDraftInput = document.getElementById( 'dt-as-draft' );\n\n\t\t/**\n\t\t * Listen for connection filtering\n\t\t */\n\t\tjQuery( connectionsSearchInput ).on( 'keyup change', _.debounce( ( event ) => {\n\t\t\tif ( '' === event.currentTarget.value ) {\n\t\t\t\tshowConnections( dtConnections );\n\t\t\t}\n\n\t\t\tsearchString = event.currentTarget.value.replace( /https?:\\/\\//i, '' ).replace( /www/i, '' ).replace( /[^0-9a-zA-Z ]+/, '' );\n\n\t\t\tshowConnections();\n\t\t}, 300 ) );\n\t}\n\n\t/**\n\t * Handle UI error changes\n\t */\n\tfunction doError() {\n\t\tdistributorPushWrapper.classList.add( 'message-error' );\n\n\t\tsetTimeout( () => {\n\t\t\tdistributorPushWrapper.classList.remove( 'message-error' );\n\t\t}, 6000 );\n\t}\n\n\t/**\n\t * Handle UI success changes\n\t */\n\tfunction doSuccess( results ) {\n\t\tlet error = false;\n\n\t\t_.each( results.internal, ( result, connectionId ) => {\n\t\t\tif ( 'fail' === result.status ) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\tdtConnections['internal' + connectionId].syndicated = result.url;\n\t\t\t}\n\t\t} );\n\n\t\t_.each( results.external, ( result, connectionId ) => {\n\t\t\tif ( 'fail' === result.status ) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\tdtConnections['external' + connectionId].syndicated = true;\n\t\t\t}\n\t\t} );\n\n\t\tif ( error ) {\n\t\t\tdoError();\n\t\t} else {\n\t\t\tdistributorPushWrapper.classList.add( 'message-success' );\n\n\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t\tconnectionsSelectedList.innerText = '';\n\n\t\t\tsetTimeout( () => {\n\t\t\t\tdistributorPushWrapper.classList.remove( 'message-success' );\n\t\t\t}, 6000 );\n\t\t}\n\n\t\tselectedConnections = {};\n\n\t\tshowConnections();\n\t}\n\n\t/**\n\t\t * Show connections. If there is a search string, then filter by it\n\t\t */\n\tfunction showConnections() {\n\t\tconnectionsNewList.innerText = '';\n\n\t\t_.each( dtConnections, ( connection ) => {\n\t\t\tif ( '' !== searchString ) {\n\t\t\t\tlet nameMatch = connection.name.replace( /[^0-9a-zA-Z ]+/, '' ).toLowerCase().match( searchString.toLowerCase() );\n\t\t\t\tlet urlMatch = connection.url.replace( /https?:\\/\\//i, '' ).replace( /www/i, '' ).replace( /[^0-9a-zA-Z ]+/, '' ).toLowerCase().match( searchString.toLowerCase() );\n\n\t\t\t\tif ( ! nameMatch && ! urlMatch ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst showConnection = processTemplate( 'dt-add-connection' )( {\n\t\t\t\tconnection: connection,\n\t\t\t\tselectedConnections: selectedConnections\n\t\t\t} );\n\n\t\t\tconnectionsNewList.innerHTML += showConnection;\n\t\t} );\n\t}\n\n\t/**\n\t * Handle distributor push dropdown menu hover using hoverIntent.\n\t */\n\tfunction distributorMenuEntered() {\n\t\tdistributorMenuItem.focus();\n\t\tdocument.body.classList.toggle( 'distributor-show' );\n\n\t\tif ( distributorPushWrapper.classList.contains( 'loaded' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdistributorPushWrapper.classList.remove( 'message-error' );\n\t\tdistributorPushWrapper.classList.add( 'loaded' );\n\n\t\tconst data = {\n\t\t\taction: 'dt_load_connections',\n\t\t\tloadConnectionsNonce: dt.loadConnectionsNonce,\n\t\t\tpostId: dt.postId\n\t\t};\n\n\t\tconst xhr = dt.usexhr ? { withCredentials: true } : false;\n\n\t\tjQuery.ajax( {\n\t\t\turl: dt.ajaxurl,\n\t\t\txhrFields: xhr,\n\t\t\tmethod: 'post',\n\t\t\tdata: data\n\t\t} ).done( ( response ) => {\n\t\t\tif ( ! response.success || ! response.data ) {\n\t\t\t\tdistributorPushWrapper.classList.remove( 'loaded' );\n\t\t\t\tdistributorPushWrapper.classList.add( 'message-error' );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdtConnections = response.data;\n\n\t\t\t// Allowing innerHTML because processTemplate escapes values\n\t\t\tdistributorPushWrapper.innerHTML = processTemplate( 'dt-show-connections' )( {\n\t\t\t\tconnections: dtConnections,\n\t\t\t} );\n\n\t\t\tsetVariables();\n\t\t} ).error( () => {\n\t\t\tdistributorPushWrapper.classList.remove( 'loaded' );\n\t\t\tdistributorPushWrapper.classList.add( 'message-error' );\n\t\t} );\n\t}\n\n\t/**\n\t * Handle exiting the distributor menu.\n\t */\n\tfunction distributorMenuExited() {\n\t\tdistributorMenuItem.blur();\n\t\tdocument.body.classList.toggle( 'distributor-show' );\n\t}\n\n\tjQuery( distributorMenuItem ).hoverIntent( distributorMenuEntered, 300, distributorMenuExited );\n\n\t/**\n\t * Do syndication ajax\n\t */\n\tjQuery( distributorPushWrapper ).on( 'click', '.syndicate-button', () => {\n\t\tif ( actionWrapper.classList.contains( 'loading' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tactionWrapper.classList.add( 'loading' );\n\n\t\tconst data = {\n\t\t\taction: 'dt_push',\n\t\t\tnonce: dt.nonce,\n\t\t\tconnections: selectedConnections,\n\t\t\tpostId: dt.postId\n\t\t};\n\n\t\tdata.postStatus = ( null !== asDraftInput && asDraftInput.checked ) ? 'draft' : postStatusInput.value;\n\n\t\tconst xhr = dt.usexhr ? { withCredentials: true } : false;\n\n\t\tjQuery.ajax( {\n\t\t\turl: dt.ajaxurl,\n\t\t\txhrFields: xhr,\n\t\t\tmethod: 'post',\n\t\t\tdata: data\n\t\t} ).done( ( response ) => {\n\t\t\tsetTimeout( () => {\n\t\t\t\tactionWrapper.classList.remove( 'loading' );\n\n\t\t\t\tif ( ! response.data || ! response.data.results ) {\n\t\t\t\t\tdoError();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdoSuccess( response.data.results );\n\t\t\t}, 500 );\n\t\t} ).error( () => {\n\t\t\tsetTimeout( () => {\n\t\t\t\tactionWrapper.classList.remove( 'loading' );\n\n\t\t\t\tdoError();\n\t\t\t}, 500 );\n\t\t} );\n\t} );\n\n\t/**\n\t * Add a connection to selected connections for ajax and to the UI list.\n\t */\n\tjQuery( distributorPushWrapper ).on( 'click', '.add-connection', ( event ) => {\n\t\tif ( 'A' === event.target.nodeName ) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tif ( event.currentTarget.classList.contains( 'syndicated' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( event.currentTarget.classList.contains( 'added' ) ) {\n\n\t\t\tconst type = event.currentTarget.getAttribute( 'data-connection-type' );\n\t\t\tconst id = event.currentTarget.getAttribute( 'data-connection-id' );\n\n\t\t\tconst deleteNode = connectionsSelectedList.querySelector( '[data-connection-id=\"' + id + '\"][data-connection-type=\"' + type + '\"]' );\n\n\t\t\tdeleteNode.parentNode.removeChild( deleteNode );\n\n\t\t\tdelete selectedConnections[type + id];\n\n\t\t\tif ( ! Object.keys( selectedConnections ).length ) {\n\t\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t\t}\n\n\t\t\tshowConnections();\n\t\t} else {\n\n\t\t\tconst type = event.currentTarget.getAttribute( 'data-connection-type' );\n\t\t\tconst id = event.currentTarget.getAttribute( 'data-connection-id' );\n\n\t\t\tselectedConnections[type + id] = dtConnections[type + id];\n\n\t\t\tconnectionsSelected.classList.remove( 'empty' );\n\n\t\t\tconst element = event.currentTarget.cloneNode();\n\t\t\telement.innerText = event.currentTarget.innerText;\n\n\t\t\tconst removeLink = document.createElement( 'span' );\n\t\t\tremoveLink.classList.add( 'remove-connection' );\n\n\t\t\telement.appendChild( removeLink );\n\t\t\telement.classList = 'added-connection';\n\n\t\t\tconnectionsSelectedList.appendChild( element );\n\n\t\t\tshowConnections();\n\t\t}\n\t} );\n\n\t/**\n\t * Remove a connection from selected connections and the UI list\n\t */\n\tjQuery( distributorPushWrapper ).on( 'click', '.remove-connection', ( event ) => {\n\t\tevent.currentTarget.parentNode.parentNode.removeChild( event.currentTarget.parentNode );\n\t\tconst type = event.currentTarget.parentNode.getAttribute( 'data-connection-type' );\n\t\tconst id = event.currentTarget.parentNode.getAttribute( 'data-connection-id' );\n\n\t\tdelete selectedConnections[type + id];\n\n\t\tif ( ! Object.keys( selectedConnections ).length ) {\n\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t}\n\n\t\tshowConnections();\n\t} );\n} );\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/push.js"],"sourceRoot":""} \ No newline at end of file diff --git a/distributor.php b/distributor.php index de96a55ab..d8b7d93c0 100644 --- a/distributor.php +++ b/distributor.php @@ -2,7 +2,7 @@ /** * Plugin Name: Distributor * Description: Makes it easy to syndicate and reuse content across your websites, whether inside of a multisite or across the web. - * Version: 1.4.1 + * Version: 1.5.0 * Author: 10up Inc. * Author URI: https://distributorplugin.com * License: GPLv2 or later @@ -17,7 +17,7 @@ exit; // Exit if accessed directly. } -define( 'DT_VERSION', '1.4.1' ); +define( 'DT_VERSION', '1.5.0' ); define( 'DT_PLUGIN_FILE', preg_replace( '#^.*plugins/(.*)$#i', '$1', __FILE__ ) ); // Define a constant if we're network activated to allow plugin to respond accordingly. diff --git a/includes/classes/ExternalConnections/WordPressExternalConnection.php b/includes/classes/ExternalConnections/WordPressExternalConnection.php index cff5eac73..4f011ddd9 100644 --- a/includes/classes/ExternalConnections/WordPressExternalConnection.php +++ b/includes/classes/ExternalConnections/WordPressExternalConnection.php @@ -152,6 +152,18 @@ public function remote_get( $args = array() ) { if ( ! empty( $args['s'] ) ) { $query_args['search'] = $args['s']; } + + if ( ! empty( $args['orderby'] ) ) { + if ( 'post__in' === $args['orderby']) { + $query_args['orderby'] = 'include'; + } else { + $query_args['orderby'] = strtolower( $args['orderby'] ); + } + } + + if ( ! empty( $args['order'] ) ) { + $query_args['order'] = strtolower( $args['order'] ); + } } static $types_urls; @@ -613,9 +625,10 @@ public function push( $post_id, $args = array() ) { * * @param array $post_body The request body to send. * @param object $post The WP_Post that is being pushed. + * @param array $args Post args to push. * @param ExternalConnection $this The distributor connection being pushed to. */ - 'body' => apply_filters( 'dt_push_post_args', $post_body, $post, $this ), + 'body' => apply_filters( 'dt_push_post_args', $post_body, $post, $args, $this ), ) ) ); diff --git a/includes/classes/InternalConnections/NetworkSiteConnection.php b/includes/classes/InternalConnections/NetworkSiteConnection.php index 786ffcc3e..6e3b8bc39 100644 --- a/includes/classes/InternalConnections/NetworkSiteConnection.php +++ b/includes/classes/InternalConnections/NetworkSiteConnection.php @@ -123,7 +123,7 @@ public function push( $post_id, $args = array() ) { update_post_meta( $new_post_id, 'dt_original_post_url', esc_url_raw( $original_post_url ) ); if ( ! empty( $post->post_parent ) ) { - update_post_meta( $new_post, 'dt_original_post_parent', (int) $post->post_parent ); + update_post_meta( $new_post_id, 'dt_original_post_parent', (int) $post->post_parent ); } \Distributor\Utils\set_meta( $new_post_id, $meta ); @@ -222,7 +222,7 @@ public function pull( $items ) { update_post_meta( $new_post_id, 'dt_original_post_url', esc_url_raw( $post->link ) ); if ( ! empty( $post->post_parent ) ) { - update_post_meta( $new_post, 'dt_original_post_parent', (int) $post->post_parent ); + update_post_meta( $new_post_id, 'dt_original_post_parent', (int) $post->post_parent ); } \Distributor\Utils\set_meta( $new_post_id, $post->meta ); @@ -399,6 +399,14 @@ public function remote_get( $args = array() ) { $query_args['s'] = $args['s']; } + if ( ! empty( $args['orderby'] ) ) { + $query_args['orderby'] = $args['orderby']; + } + + if ( ! empty( $args['order'] ) ) { + $query_args['order'] = $args['order']; + } + $posts_query = new \WP_Query( apply_filters( 'dt_remote_get_query_args', $query_args, $args, $this ) ); $posts = $posts_query->posts; @@ -453,12 +461,14 @@ public function remote_get( $args = array() ) { */ public static function bootstrap() { add_action( 'template_redirect', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'canonicalize_front_end' ) ); - add_action( 'wp_ajax_dt_auth_check', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'auth_check' ) ); add_action( 'save_post', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'update_syndicated' ) ); add_action( 'before_delete_post', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'separate_syndicated_on_delete' ) ); add_action( 'before_delete_post', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'remove_distributor_post_from_original' ) ); add_action( 'wp_trash_post', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'separate_syndicated_on_delete' ) ); add_action( 'untrash_post', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'connect_syndicated_on_untrash' ) ); + add_action( 'clean_site_cache', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'set_sites_last_changed_time' ) ); + add_action( 'add_user_to_blog', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'rebuild_user_authorized_sites_cache' ) ); + add_action( 'remove_user_from_blog', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'rebuild_user_authorized_sites_cache' ) ); } /** @@ -621,37 +631,6 @@ public static function maybe_set_modified_date( $data, $postarr ) { return $data; } - /** - * Check if current user can create a post type with ajax - * - * @since 0.8 - */ - public static function auth_check() { - if ( ! check_ajax_referer( 'dt-auth-check', 'nonce', false ) ) { - wp_send_json_error(); - exit; - } - - if ( empty( $_POST['username'] ) ) { - wp_send_json_error(); - exit; - } - - $post_types = get_post_types(); - $authorized_post_types = array(); - - foreach ( $post_types as $post_type ) { - $post_type_object = get_post_type_object( $post_type ); - - if ( current_user_can( $post_type_object->cap->create_posts ) ) { - $authorized_post_types[] = $post_type; - } - } - - wp_send_json_success( $authorized_post_types ); - exit; - } - /** * Find out which sites user can create post type on * @@ -685,70 +664,122 @@ public static function get_available_authorized_sites( $context = null ) { return $authorized_sites; } - $sites = get_sites(); - $current_blog_id = (int) get_current_blog_id(); - $current_user = wp_get_current_user(); + $authorized_sites = self::build_available_authorized_sites( get_current_user_id(), $context ); - foreach ( $sites as $site ) { - $blog_id = (int) $site->blog_id; + /** + * Allow plugins to modify the array of authorized sites. + * + * @since 1.2 + * @since 1.3.7 Added the `$context` parameter. + * + * @param array $authorized_sites { + * @type array { + * 'site' => $site, // WP_Site object. + * 'post_types' => $array, // List of post type objects the user can edit. + * } + * @param string $context The context of the authorization. + */ + return apply_filters( 'dt_authorized_sites', $authorized_sites, $context ); + } - if ( $blog_id === $current_blog_id ) { - continue; - } + /** + * Build the available sites a specific user is authorized to use. + * + * @param int|bool $user_id Current user ID + * @param string $context The context of the authorization. Either push or pull + * @param bool $force Force a cache clear. Default false + * + * @return array + */ + public static function build_available_authorized_sites( $user_id = false, $context = null, $force = false ) { + $user_id = ! $user_id ? get_current_user_id() : $user_id; + $last_changed = get_site_option( 'last_changed_sites' ); - $base_url = get_site_url( $blog_id ); + if ( ! $last_changed ) { + $last_changed = microtime(); + self::set_sites_last_changed_time(); + } - if ( empty( $base_url ) ) { - continue; - } + $cache_key = "authorized_sites:$user_id:$context:$last_changed"; + $authorized_sites = get_transient( $cache_key ); - $response = wp_remote_post( - untrailingslashit( $base_url ) . '/wp-admin/admin-ajax.php', + if ( $force || false === $authorized_sites ) { + $sites = get_sites( array( - 'body' => array( - 'nonce' => wp_create_nonce( 'dt-auth-check' ), - 'username' => $current_user->user_login, - 'action' => 'dt_auth_check', - ), - 'cookies' => $_COOKIE, // WPCS: Input var ok. + 'number' => 1000, ) ); + $current_blog_id = (int) get_current_blog_id(); - if ( ! is_wp_error( $response ) ) { + foreach ( $sites as $site ) { + $blog_id = (int) $site->blog_id; - $body = wp_remote_retrieve_body( $response ); + if ( $blog_id === $current_blog_id ) { + continue; + } + + $base_url = get_site_url( $blog_id ); - if ( ! empty( $body ) ) { - try { - $body_array = json_decode( $body, true ); + if ( empty( $base_url ) ) { + continue; + } - if ( ! empty( $body_array['success'] ) ) { - $authorized_sites[] = array( - 'site' => $site, - 'post_types' => $body_array['data'], - ); - } - } catch ( \Exception $e ) { - continue; + switch_to_blog( $blog_id ); + + $post_types = get_post_types(); + $authorized_post_types = array(); + + foreach ( $post_types as $post_type ) { + $post_type_object = get_post_type_object( $post_type ); + + if ( current_user_can( $post_type_object->cap->create_posts ) ) { + $authorized_post_types[] = $post_type; } } + + if ( ! empty( $authorized_post_types ) ) { + $authorized_sites[] = array( + 'site' => $site, + 'post_types' => $authorized_post_types, + ); + } + + restore_current_blog(); } } - /** - * Allow plugins to modify the array of authorized sites. - * - * @since 1.2 - * @since 1.3.7 Added the `$context` parameter. - * - * @param array $authorized_sites { - * @type array { - * 'site' => $site, // WP_Site object. - * 'post_types' => $array, // List of post type objects the user can edit. - * } - * @param string $context The context of the authorization. - */ - return apply_filters( 'dt_authorized_sites', $authorized_sites, $context ); + // Make sure we save and return an array. + $authorized_sites = ! is_array( $authorized_sites ) ? array() : $authorized_sites; + + set_transient( $cache_key, $authorized_sites, 15 * MINUTE_IN_SECONDS ); + + return $authorized_sites; + } + + /** + * Whenever site data changes, save the timestamp. + * + * WordPress stores this same information in the cache + * {@see clean_blog_cache()}, but not all environments + * will have caching enabled, so we also store it + * in a site option. + * + * @return void + */ + public static function set_sites_last_changed_time() { + update_site_option( 'last_changed_sites', microtime() ); + } + + /** + * Rebuild the authorized sites cache for a specific user. + * + * @param int $user_id Current user ID. + * + * @return void + */ + public static function rebuild_user_authorized_sites_cache( $user_id ) { + self::build_available_authorized_sites( $user_id, 'push', true ); + self::build_available_authorized_sites( $user_id, 'pull', true ); } /** diff --git a/includes/classes/PullListTable.php b/includes/classes/PullListTable.php index 20d1145ab..c1352c9ec 100644 --- a/includes/classes/PullListTable.php +++ b/includes/classes/PullListTable.php @@ -60,28 +60,13 @@ public function get_columns() { ]; // Remove checkbox column on the Pulled view - if ( isset( $_GET['status'] ) && 'pulled' === $_GET['status'] ) { + if ( isset( $_GET['status'] ) && 'pulled' === $_GET['status'] ) { // @codingStandardsIgnoreLine Nonce not needed. unset( $columns['cb'] ); } return $columns; } - /** - * Get sortable table columns - * - * @since 0.8 - * @return array - */ - public function get_sortable_columns() { - $sortable_columns = array( - 'name' => 'name', - 'date' => array( 'date', true ), - ); - - return $sortable_columns; - } - /** * Get table views * @@ -191,6 +176,18 @@ protected function bulk_actions( $which = '' ) { public function column_date( $post ) { global $mode; + if ( ! empty( $this->sync_log ) && ( empty( $_GET['status'] ) || 'new' === $_GET['status'] ) ) { // @codingStandardsIgnoreLine Nonce not needed. + if ( isset( $this->sync_log[ $post->ID ] ) ) { + if ( false === $this->sync_log[ $post->ID ] ) { + echo '' . esc_html__( 'Skipped', 'distributor' ) . ''; + return; + } else { + echo '' . esc_html__( 'Pulled', 'distributor' ) . ''; + return; + } + } + } + if ( ! empty( $_GET['status'] ) && 'pulled' === $_GET['status'] ) { // @codingStandardsIgnoreLine Nonce isn't required. if ( ! empty( $this->sync_log[ $post->ID ] ) ) { $syndicated_at = get_post_meta( $this->sync_log[ $post->ID ], 'dt_syndicate_time', true ); @@ -314,12 +311,18 @@ public function column_name( $item ) { } $actions = []; + $disable = false; if ( empty( $_GET['status'] ) || 'new' === $_GET['status'] ) { // @codingStandardsIgnoreLine Nonce not needed. - $actions = [ - 'view' => '' . esc_html__( 'View', 'distributor' ) . '', - 'skip' => sprintf( '%s', esc_url( wp_nonce_url( admin_url( 'admin.php?page=pull&action=skip&_wp_http_referer=' . rawurlencode( $_SERVER['REQUEST_URI'] ) . '&post=' . $item->ID . '&connection_type=' . $connection_type . '&connection_id=' . $connection_id ), 'dt_skip' ) ), esc_html__( 'Skip', 'distributor' ) ), - ]; + if ( isset( $this->sync_log[ $item->ID ] ) ) { + $actions = []; + $disable = true; + } else { + $actions = [ + 'view' => '' . esc_html__( 'View', 'distributor' ) . '', + 'skip' => sprintf( '%s', esc_url( wp_nonce_url( admin_url( 'admin.php?page=pull&action=skip&_wp_http_referer=' . rawurlencode( $_SERVER['REQUEST_URI'] ) . '&post=' . $item->ID . '&connection_type=' . $connection_type . '&connection_id=' . $connection_id ), 'dt_skip' ) ), esc_html__( 'Skip', 'distributor' ) ), + ]; + } } elseif ( 'skipped' === $_GET['status'] ) { // @codingStandardsIgnoreLine Nonce not needed. $actions = [ 'view' => '' . esc_html__( 'View', 'distributor' ) . '', @@ -343,8 +346,16 @@ public function column_name( $item ) { $title = esc_html__( '(no title)', 'distributor' ); } + if ( $disable ) { + echo '
'; + } + echo '' . esc_html( $title ) . ''; echo wp_kses_post( $this->row_actions( $actions ) ); + + if ( $disable ) { + echo '
'; + } } /** @@ -361,7 +372,7 @@ public function prepare_items() { $columns = $this->get_columns(); $hidden = get_hidden_columns( $this->screen ); - $sortable = $this->get_sortable_columns(); + $sortable = []; $data = $this->table_data(); @@ -378,6 +389,8 @@ public function prepare_items() { 'posts_per_page' => $per_page, 'paged' => $current_page, 'post_type' => $connection_now->pull_post_type ?: 'post', + 'orderby' => 'ID', // this is because of include/exclude truncation + 'order' => 'DESC', // default but specifying to be safe ]; if ( ! empty( $_GET['s'] ) ) { // @codingStandardsIgnoreLine Nonce isn't required. @@ -400,8 +413,9 @@ public function prepare_items() { $this->sync_log = []; } - $skipped = array(); - $syndicated = array(); + $skipped = array(); + $syndicated = array(); + $total_items = false; foreach ( $this->sync_log as $old_post_id => $new_post_id ) { if ( false === $new_post_id ) { @@ -412,7 +426,15 @@ public function prepare_items() { } if ( empty( $_GET['status'] ) || 'new' === $_GET['status'] ) { // @codingStandardsIgnoreLine Nonce not required. - $remote_get_args['post__not_in'] = array_merge( $skipped, $syndicated ); + // Sort from highest ID (newest) to low so the slice only affects later pagination. + rsort( $skipped, SORT_NUMERIC ); + rsort( $syndicated, SORT_NUMERIC ); + + // This is somewhat arbitrarily set to 200 and should probably be made filterable eventually. + // IDs can get rather large and 400 easily exceeds typical header size limits. + $post_ids = array_slice( array_merge( $skipped, $syndicated ), 0, 200, true ); + + $remote_get_args['post__not_in'] = $post_ids; $remote_get_args['meta_query'] = [ [ @@ -421,9 +443,25 @@ public function prepare_items() { ], ]; } elseif ( 'skipped' === $_GET['status'] ) { // @codingStandardsIgnoreLine Nonce not required. - $remote_get_args['post__in'] = $skipped; + // Put most recently skipped items first. + $skipped = array_reverse( $skipped ); + $total_items = count( $skipped ); + $offset = $per_page * ( $current_page - 1 ); + $post_ids = array_slice( $skipped, $offset, $per_page, true ); + + $remote_get_args['post__in'] = $post_ids; + $remote_get_args['orderby'] = 'post__in'; + $remote_get_args['paged'] = 1; } else { - $remote_get_args['post__in'] = $syndicated; + // Put most recently pulled items first. + $syndicated = array_reverse( $syndicated ); + $total_items = count( $syndicated ); + $offset = $per_page * ( $current_page - 1 ); + $post_ids = array_slice( $syndicated, $offset, $per_page, true ); + + $remote_get_args['post__in'] = $post_ids; + $remote_get_args['orderby'] = 'post__in'; + $remote_get_args['paged'] = 1; } $remote_get = $connection_now->remote_get( $remote_get_args ); @@ -434,9 +472,14 @@ public function prepare_items() { return; } + // Get total items retrieved from the remote request if not already set. + if ( false === $total_items ) { + $total_items = $remote_get['total_items']; + } + $this->set_pagination_args( [ - 'total_items' => $remote_get['total_items'], + 'total_items' => $total_items, 'per_page' => $per_page, ] ); @@ -453,6 +496,9 @@ public function prepare_items() { * @param \WP_Post $post The current WP_Post object. */ public function column_cb( $post ) { + if ( isset( $this->sync_log[ $post->ID ] ) ) { + return; + } ?>