{"action":"created","comment":{"url":"https://api.github.com/repos/ampproject/amp-wp/pulls/comments/352273325","pull_request_review_id":324882589,"id":352273325,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM1MjI3MzMyNQ==","diff_hunk":"@@ -2495,6 +2503,128 @@ public static function enqueue_assets() {\n \t\twp_styles()->add_data( 'amp-default', 'rtl', 'replace' );\n \t}\n \n+\t/**\n+\t * Setup pages to have the paired browsing client script so that the app can interact with it.\n+\t *\n+\t * @return void\n+\t */\n+\tpublic static function setup_paired_browsing_client() {\n+\t\t// phpcs:ignore WordPress.Security.NonceVerification.Recommended\n+\t\tif ( isset( $_GET[ self::PAIRED_BROWSING_QUERY_VAR ] ) ) {\n+\t\t\treturn;\n+\t\t}\n+\n+\t\t$asset_file   = AMP__DIR__ . '/assets/js/amp-paired-browsing-client.asset.php';\n+\t\t$asset        = require $asset_file;\n+\t\t$dependencies = $asset['dependencies'];\n+\t\t$version      = $asset['version'];\n+\n+\t\twp_enqueue_script(\n+\t\t\t'amp-paired-browsing-client',\n+\t\t\tamp_get_asset_url( '/js/amp-paired-browsing-client.js' ),\n+\t\t\t$dependencies,\n+\t\t\t$version,\n+\t\t\ttrue\n+\t\t);\n+\n+\t\t// Force dev mode to be enabled. This ensures that the enqueued script and its dependencies\n+\t\t// will be present when the admin bar is not showing.\n+\t\tadd_filter(\n+\t\t\t'amp_dev_mode_enabled',\n+\t\t\tstatic function () {\n+\t\t\t\treturn true;\n+\t\t\t}\n+\t\t);\n+\n+\t\t// Whitelist enqueued script so that it is not removed.\n+\t\tadd_filter( 'script_loader_tag', [ __CLASS__, 'filter_paired_browsing_client_script_loader_tag' ], 10, 2 );\n+\t}\n+\n+\t/**\n+\t * Add the `data-ampdevmode` attribute to any enqueued script that the paired browsing interface\n+\t * depends on.\n+\t *\n+\t * @since 1.3\n+\t *\n+\t * @param string $tag    The link tag for the enqueued script.\n+\t * @param string $handle The script's registered handle.\n+\t * @return string Tag.\n+\t */\n+\tpublic static function filter_paired_browsing_client_script_loader_tag( $tag, $handle ) {\n+\t\tif ( self::has_dependency( wp_scripts(), 'amp-paired-browsing-client', $handle ) ) {\n+\t\t\t$tag = preg_replace( '/(?<=<script)(?=\\s|>)/i', ' ' . AMP_Rule_Spec::DEV_MODE_ATTRIBUTE, $tag );\n+\t\t}\n+\n+\t\treturn $tag;\n+\t}\n+\n+\t/**\n+\t * Remove any unnecessary query vars that could hamper the paired browsing experience.\n+\t */\n+\tpublic static function sanitize_url_for_paired_browsing() {","path":"includes/class-amp-theme-support.php","position":79,"original_position":84,"commit_id":"05fc0b06fb3aab1fd6826174cb035ae6ae1de86d","original_commit_id":"d86ba3f0b31488bc6900e61a4f367e4439bab3ba","user":{"login":"westonruter","id":134745,"node_id":"MDQ6VXNlcjEzNDc0NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/134745?v=4","gravatar_id":"","url":"https://api.github.com/users/westonruter","html_url":"https://github.com/westonruter","followers_url":"https://api.github.com/users/westonruter/followers","following_url":"https://api.github.com/users/westonruter/following{/other_user}","gists_url":"https://api.github.com/users/westonruter/gists{/gist_id}","starred_url":"https://api.github.com/users/westonruter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/westonruter/subscriptions","organizations_url":"https://api.github.com/users/westonruter/orgs","repos_url":"https://api.github.com/users/westonruter/repos","events_url":"https://api.github.com/users/westonruter/events{/privacy}","received_events_url":"https://api.github.com/users/westonruter/received_events","type":"User","site_admin":false},"body":"OK, I see not. Well, this isn't so important. The thinking here is that if you had a validated URL which has removed markup, and you then go to mark one invalid markup as kept and click preview, at that point on the frontend it could be possible to click the “Start paired browsing” link to then see the original and the _previewed_ side-by-side. But this could get confusing. So let's defer that to think about later.","created_at":"2019-11-30T08:28:02Z","updated_at":"2019-11-30T08:28:02Z","html_url":"https://github.com/ampproject/amp-wp/pull/3656#discussion_r352273325","pull_request_url":"https://api.github.com/repos/ampproject/amp-wp/pulls/3656","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/ampproject/amp-wp/pulls/comments/352273325"},"html":{"href":"https://github.com/ampproject/amp-wp/pull/3656#discussion_r352273325"},"pull_request":{"href":"https://api.github.com/repos/ampproject/amp-wp/pulls/3656"}},"in_reply_to_id":351617646},"pull_request":{"url":"https://api.github.com/repos/ampproject/amp-wp/pulls/3656","id":333339567,"node_id":"MDExOlB1bGxSZXF1ZXN0MzMzMzM5NTY3","html_url":"https://github.com/ampproject/amp-wp/pull/3656","diff_url":"https://github.com/ampproject/amp-wp/pull/3656.diff","patch_url":"https://github.com/ampproject/amp-wp/pull/3656.patch","issue_url":"https://api.github.com/repos/ampproject/amp-wp/issues/3656","number":3656,"state":"open","locked":false,"title":"Add paired browsing interface","user":{"login":"pierlon","id":16200219,"node_id":"MDQ6VXNlcjE2MjAwMjE5","avatar_url":"https://avatars0.githubusercontent.com/u/16200219?v=4","gravatar_id":"","url":"https://api.github.com/users/pierlon","html_url":"https://github.com/pierlon","followers_url":"https://api.github.com/users/pierlon/followers","following_url":"https://api.github.com/users/pierlon/following{/other_user}","gists_url":"https://api.github.com/users/pierlon/gists{/gist_id}","starred_url":"https://api.github.com/users/pierlon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pierlon/subscriptions","organizations_url":"https://api.github.com/users/pierlon/orgs","repos_url":"https://api.github.com/users/pierlon/repos","events_url":"https://api.github.com/users/pierlon/events{/privacy}","received_events_url":"https://api.github.com/users/pierlon/received_events","type":"User","site_admin":false},"body":"## Summary\r\n<!-- Please reference the issue this PR addresses. -->\r\nFixes #3365.\r\n\r\n## Todo\r\n\r\n- [x] Extract the template for paired browsing into its own file\r\n- [ ] ~Add support for paired browsing while in Standard mode.~\r\n- [x] Add paired browsing button to AMP Validated URL status metabox.\r\n- [x] Provide means of exiting paired browsing mode, perhaps meaning an additional paired browsing bar appearing at top of page.\r\n- [x] Allow paired browsing while admin bar is not showing. This will likely mean persisting certain paired-mode query vars on links and forms so that the required JS in the window will be loaded. Or else, the parent window can instead be polling for access to the iframe window contents.\r\n- [ ] If AMP window initializes without AMP query var, then show AMP not available message, and make iframe hidden. Make sure that that if AMP is disabled for a given post or template that the failure to show AMP version is handled.\r\n- [x] Add a label to each iframe for clear identification\r\n\r\n## Checklist\r\n\r\n- [x] My pull request is addressing an [open issue](https://github.com/ampproject/amp-wp/contributing/project-management.md#life-of-an-issue) (please create one otherwise).\r\n- [ ] My code is tested and passes existing [tests](https://github.com/ampproject/amp-wp/contributing/engineering.md#tests).\r\n- [x] My code follows the [Engineering Guidelines](https://github.com/ampproject/amp-wp/contributing/engineering.md) (updates are often made to the guidelines, check it out periodically).\r\n","created_at":"2019-10-28T21:48:41Z","updated_at":"2019-11-30T08:28:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c0103273ae211072495796a1756d654eebaa17a9","assignee":null,"assignees":[],"requested_reviewers":[{"login":"kienstra","id":4063887,"node_id":"MDQ6VXNlcjQwNjM4ODc=","avatar_url":"https://avatars2.githubusercontent.com/u/4063887?v=4","gravatar_id":"","url":"https://api.github.com/users/kienstra","html_url":"https://github.com/kienstra","followers_url":"https://api.github.com/users/kienstra/followers","following_url":"https://api.github.com/users/kienstra/following{/other_user}","gists_url":"https://api.github.com/users/kienstra/gists{/gist_id}","starred_url":"https://api.github.com/users/kienstra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kienstra/subscriptions","organizations_url":"https://api.github.com/users/kienstra/orgs","repos_url":"https://api.github.com/users/kienstra/repos","events_url":"https://api.github.com/users/kienstra/events{/privacy}","received_events_url":"https://api.github.com/users/kienstra/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":1159859621,"node_id":"MDU6TGFiZWwxMTU5ODU5NjIx","url":"https://api.github.com/repos/ampproject/amp-wp/labels/cla:%20yes","name":"cla: yes","color":"eeeeee","default":false,"description":"Signed the Google CLA"}],"milestone":null,"commits_url":"https://api.github.com/repos/ampproject/amp-wp/pulls/3656/commits","review_comments_url":"https://api.github.com/repos/ampproject/amp-wp/pulls/3656/comments","review_comment_url":"https://api.github.com/repos/ampproject/amp-wp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ampproject/amp-wp/issues/3656/comments","statuses_url":"https://api.github.com/repos/ampproject/amp-wp/statuses/05fc0b06fb3aab1fd6826174cb035ae6ae1de86d","head":{"label":"ampproject:enhancement/3365-paired-browsing","ref":"enhancement/3365-paired-browsing","sha":"05fc0b06fb3aab1fd6826174cb035ae6ae1de86d","user":{"login":"ampproject","id":14114390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTE0Mzkw","avatar_url":"https://avatars3.githubusercontent.com/u/14114390?v=4","gravatar_id":"","url":"https://api.github.com/users/ampproject","html_url":"https://github.com/ampproject","followers_url":"https://api.github.com/users/ampproject/followers","following_url":"https://api.github.com/users/ampproject/following{/other_user}","gists_url":"https://api.github.com/users/ampproject/gists{/gist_id}","starred_url":"https://api.github.com/users/ampproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ampproject/subscriptions","organizations_url":"https://api.github.com/users/ampproject/orgs","repos_url":"https://api.github.com/users/ampproject/repos","events_url":"https://api.github.com/users/ampproject/events{/privacy}","received_events_url":"https://api.github.com/users/ampproject/received_events","type":"Organization","site_admin":false},"repo":{"id":42912130,"node_id":"MDEwOlJlcG9zaXRvcnk0MjkxMjEzMA==","name":"amp-wp","full_name":"ampproject/amp-wp","private":false,"owner":{"login":"ampproject","id":14114390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTE0Mzkw","avatar_url":"https://avatars3.githubusercontent.com/u/14114390?v=4","gravatar_id":"","url":"https://api.github.com/users/ampproject","html_url":"https://github.com/ampproject","followers_url":"https://api.github.com/users/ampproject/followers","following_url":"https://api.github.com/users/ampproject/following{/other_user}","gists_url":"https://api.github.com/users/ampproject/gists{/gist_id}","starred_url":"https://api.github.com/users/ampproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ampproject/subscriptions","organizations_url":"https://api.github.com/users/ampproject/orgs","repos_url":"https://api.github.com/users/ampproject/repos","events_url":"https://api.github.com/users/ampproject/events{/privacy}","received_events_url":"https://api.github.com/users/ampproject/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ampproject/amp-wp","description":"Enable AMP on your WordPress site, the WordPress way.","fork":false,"url":"https://api.github.com/repos/ampproject/amp-wp","forks_url":"https://api.github.com/repos/ampproject/amp-wp/forks","keys_url":"https://api.github.com/repos/ampproject/amp-wp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ampproject/amp-wp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ampproject/amp-wp/teams","hooks_url":"https://api.github.com/repos/ampproject/amp-wp/hooks","issue_events_url":"https://api.github.com/repos/ampproject/amp-wp/issues/events{/number}","events_url":"https://api.github.com/repos/ampproject/amp-wp/events","assignees_url":"https://api.github.com/repos/ampproject/amp-wp/assignees{/user}","branches_url":"https://api.github.com/repos/ampproject/amp-wp/branches{/branch}","tags_url":"https://api.github.com/repos/ampproject/amp-wp/tags","blobs_url":"https://api.github.com/repos/ampproject/amp-wp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ampproject/amp-wp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ampproject/amp-wp/git/refs{/sha}","trees_url":"https://api.github.com/repos/ampproject/amp-wp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ampproject/amp-wp/statuses/{sha}","languages_url":"https://api.github.com/repos/ampproject/amp-wp/languages","stargazers_url":"https://api.github.com/repos/ampproject/amp-wp/stargazers","contributors_url":"https://api.github.com/repos/ampproject/amp-wp/contributors","subscribers_url":"https://api.github.com/repos/ampproject/amp-wp/subscribers","subscription_url":"https://api.github.com/repos/ampproject/amp-wp/subscription","commits_url":"https://api.github.com/repos/ampproject/amp-wp/commits{/sha}","git_commits_url":"https://api.github.com/repos/ampproject/amp-wp/git/commits{/sha}","comments_url":"https://api.github.com/repos/ampproject/amp-wp/comments{/number}","issue_comment_url":"https://api.github.com/repos/ampproject/amp-wp/issues/comments{/number}","contents_url":"https://api.github.com/repos/ampproject/amp-wp/contents/{+path}","compare_url":"https://api.github.com/repos/ampproject/amp-wp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ampproject/amp-wp/merges","archive_url":"https://api.github.com/repos/ampproject/amp-wp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ampproject/amp-wp/downloads","issues_url":"https://api.github.com/repos/ampproject/amp-wp/issues{/number}","pulls_url":"https://api.github.com/repos/ampproject/amp-wp/pulls{/number}","milestones_url":"https://api.github.com/repos/ampproject/amp-wp/milestones{/number}","notifications_url":"https://api.github.com/repos/ampproject/amp-wp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ampproject/amp-wp/labels{/name}","releases_url":"https://api.github.com/repos/ampproject/amp-wp/releases{/id}","deployments_url":"https://api.github.com/repos/ampproject/amp-wp/deployments","created_at":"2015-09-22T04:52:15Z","updated_at":"2019-11-30T05:54:31Z","pushed_at":"2019-11-30T06:23:31Z","git_url":"git://github.com/ampproject/amp-wp.git","ssh_url":"git@github.com:ampproject/amp-wp.git","clone_url":"https://github.com/ampproject/amp-wp.git","svn_url":"https://github.com/ampproject/amp-wp","homepage":"https://wordpress.org/plugins/amp/","size":58532,"stargazers_count":1499,"watchers_count":1499,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":339,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":280,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":339,"open_issues":280,"watchers":1499,"default_branch":"develop"}},"base":{"label":"ampproject:develop","ref":"develop","sha":"12c1d47382fbde382132c1fecc68e85e552c45b0","user":{"login":"ampproject","id":14114390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTE0Mzkw","avatar_url":"https://avatars3.githubusercontent.com/u/14114390?v=4","gravatar_id":"","url":"https://api.github.com/users/ampproject","html_url":"https://github.com/ampproject","followers_url":"https://api.github.com/users/ampproject/followers","following_url":"https://api.github.com/users/ampproject/following{/other_user}","gists_url":"https://api.github.com/users/ampproject/gists{/gist_id}","starred_url":"https://api.github.com/users/ampproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ampproject/subscriptions","organizations_url":"https://api.github.com/users/ampproject/orgs","repos_url":"https://api.github.com/users/ampproject/repos","events_url":"https://api.github.com/users/ampproject/events{/privacy}","received_events_url":"https://api.github.com/users/ampproject/received_events","type":"Organization","site_admin":false},"repo":{"id":42912130,"node_id":"MDEwOlJlcG9zaXRvcnk0MjkxMjEzMA==","name":"amp-wp","full_name":"ampproject/amp-wp","private":false,"owner":{"login":"ampproject","id":14114390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTE0Mzkw","avatar_url":"https://avatars3.githubusercontent.com/u/14114390?v=4","gravatar_id":"","url":"https://api.github.com/users/ampproject","html_url":"https://github.com/ampproject","followers_url":"https://api.github.com/users/ampproject/followers","following_url":"https://api.github.com/users/ampproject/following{/other_user}","gists_url":"https://api.github.com/users/ampproject/gists{/gist_id}","starred_url":"https://api.github.com/users/ampproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ampproject/subscriptions","organizations_url":"https://api.github.com/users/ampproject/orgs","repos_url":"https://api.github.com/users/ampproject/repos","events_url":"https://api.github.com/users/ampproject/events{/privacy}","received_events_url":"https://api.github.com/users/ampproject/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ampproject/amp-wp","description":"Enable AMP on your WordPress site, the WordPress way.","fork":false,"url":"https://api.github.com/repos/ampproject/amp-wp","forks_url":"https://api.github.com/repos/ampproject/amp-wp/forks","keys_url":"https://api.github.com/repos/ampproject/amp-wp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ampproject/amp-wp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ampproject/amp-wp/teams","hooks_url":"https://api.github.com/repos/ampproject/amp-wp/hooks","issue_events_url":"https://api.github.com/repos/ampproject/amp-wp/issues/events{/number}","events_url":"https://api.github.com/repos/ampproject/amp-wp/events","assignees_url":"https://api.github.com/repos/ampproject/amp-wp/assignees{/user}","branches_url":"https://api.github.com/repos/ampproject/amp-wp/branches{/branch}","tags_url":"https://api.github.com/repos/ampproject/amp-wp/tags","blobs_url":"https://api.github.com/repos/ampproject/amp-wp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ampproject/amp-wp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ampproject/amp-wp/git/refs{/sha}","trees_url":"https://api.github.com/repos/ampproject/amp-wp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ampproject/amp-wp/statuses/{sha}","languages_url":"https://api.github.com/repos/ampproject/amp-wp/languages","stargazers_url":"https://api.github.com/repos/ampproject/amp-wp/stargazers","contributors_url":"https://api.github.com/repos/ampproject/amp-wp/contributors","subscribers_url":"https://api.github.com/repos/ampproject/amp-wp/subscribers","subscription_url":"https://api.github.com/repos/ampproject/amp-wp/subscription","commits_url":"https://api.github.com/repos/ampproject/amp-wp/commits{/sha}","git_commits_url":"https://api.github.com/repos/ampproject/amp-wp/git/commits{/sha}","comments_url":"https://api.github.com/repos/ampproject/amp-wp/comments{/number}","issue_comment_url":"https://api.github.com/repos/ampproject/amp-wp/issues/comments{/number}","contents_url":"https://api.github.com/repos/ampproject/amp-wp/contents/{+path}","compare_url":"https://api.github.com/repos/ampproject/amp-wp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ampproject/amp-wp/merges","archive_url":"https://api.github.com/repos/ampproject/amp-wp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ampproject/amp-wp/downloads","issues_url":"https://api.github.com/repos/ampproject/amp-wp/issues{/number}","pulls_url":"https://api.github.com/repos/ampproject/amp-wp/pulls{/number}","milestones_url":"https://api.github.com/repos/ampproject/amp-wp/milestones{/number}","notifications_url":"https://api.github.com/repos/ampproject/amp-wp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ampproject/amp-wp/labels{/name}","releases_url":"https://api.github.com/repos/ampproject/amp-wp/releases{/id}","deployments_url":"https://api.github.com/repos/ampproject/amp-wp/deployments","created_at":"2015-09-22T04:52:15Z","updated_at":"2019-11-30T05:54:31Z","pushed_at":"2019-11-30T06:23:31Z","git_url":"git://github.com/ampproject/amp-wp.git","ssh_url":"git@github.com:ampproject/amp-wp.git","clone_url":"https://github.com/ampproject/amp-wp.git","svn_url":"https://github.com/ampproject/amp-wp","homepage":"https://wordpress.org/plugins/amp/","size":58532,"stargazers_count":1499,"watchers_count":1499,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":339,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":280,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":339,"open_issues":280,"watchers":1499,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ampproject/amp-wp/pulls/3656"},"html":{"href":"https://github.com/ampproject/amp-wp/pull/3656"},"issue":{"href":"https://api.github.com/repos/ampproject/amp-wp/issues/3656"},"comments":{"href":"https://api.github.com/repos/ampproject/amp-wp/issues/3656/comments"},"review_comments":{"href":"https://api.github.com/repos/ampproject/amp-wp/pulls/3656/comments"},"review_comment":{"href":"https://api.github.com/repos/ampproject/amp-wp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ampproject/amp-wp/pulls/3656/commits"},"statuses":{"href":"https://api.github.com/repos/ampproject/amp-wp/statuses/05fc0b06fb3aab1fd6826174cb035ae6ae1de86d"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"westonruter"}}