diff --git a/tools/jetpack-live-branches/jetpack-live-branches.user.js b/tools/jetpack-live-branches/jetpack-live-branches.user.js index bc4a8aaa3ac40..b38a80c5d3cf6 100644 --- a/tools/jetpack-live-branches/jetpack-live-branches.user.js +++ b/tools/jetpack-live-branches/jetpack-live-branches.user.js @@ -1,12 +1,14 @@ // ==UserScript== // @name Jetpack Live Branches // @namespace https://wordpress.com/ -// @version 1.11 +// @version 1.12 // @description Adds links to PRs pointing to Jurassic Ninja sites for live-testing a changeset // @require https://code.jquery.com/jquery-3.3.1.min.js // @match https://github.com/Automattic/jetpack/pull/* // ==/UserScript== +/* global jQuery */ + ( function() { const $ = jQuery.noConflict(); doit(); @@ -19,81 +21,158 @@ $( '.gh-header-meta .State' ) .text() .trim() === 'Merged'; - const base = 'https://jurassic.ninja/create?'; - const query = `jetpack-beta&branch=${ branch }&wp-debug-log`; - let link = base + query; - const canLiveTestText = `
This branch can't be tested live because it comes from a forked version of this repo.
" + - 'This branch is already merged.
' + - 'WP_DEBUG
and WP_DEBUG_LOG
set to true',
+ name: 'wp-debug-log',
+ },
+ {
+ label: 'Multisite based on subdomains',
+ name: 'subdomain_multisite',
+ },
+ {
+ label: 'Multisite based on subdirectories',
+ name: 'subdir_multisite',
+ },
+ {
+ label: 'Pre-generate content',
+ name: 'content',
+ },
+ {
+ label: 'xmlrpc.php
unavailable',
+ name: 'blockxmlrpc',
+ },
+ ],
+ 100
+ ) }
+ + + ${ link } + +
+ `; + appendHtml( markdownBody, contents ); } else if ( ! branchIsMerged ) { - appendHtml( markdownBody, branchIsForkedText ); + appendHtml( + markdownBody, + "This branch can't be tested live because it comes from a forked version of this repo.
" + ); } else { - appendHtml( markdownBody, branchIsMergedText ); + appendHtml( markdownBody, 'This branch is already merged.
' ); + } + + function getLink() { + const query = [ 'jetpack-beta', `branch=${ branch }` ]; + $( '#jetpack-live-branches input[type=checkbox]:checked' ).each( ( i, input ) => { + query.push( input.name ); + } ); + return `https://jurassic.ninja/create?${ query.join( '&' ) }`; + } + + function getOption( { checked = false, label, name }, columnWidth ) { + return ` +