From ea82eea6f301fde074f41f029fd8192aa87d3032 Mon Sep 17 00:00:00 2001
From: Timo Tijhof
Date: Tue, 3 Oct 2023 14:21:06 -0700
Subject: [PATCH 001/126] All: Override both 'home' and 'siteurl' in local
development
This should make local development work on both HTTP and HTTPS without
one redirecting to the other. This already worked fine for api.jquery.com,
but for jquery.com and releases.jquery.com it was still redirecting
due lucky but unrelated differences in the live database state.
---
plugins/jquery-filters.php | 11 -----------
sites.php | 12 +++++++++++-
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/plugins/jquery-filters.php b/plugins/jquery-filters.php
index 546bed7a..3f4482de 100644
--- a/plugins/jquery-filters.php
+++ b/plugins/jquery-filters.php
@@ -148,17 +148,6 @@ function strip_https($url) {
return $post_data;
}, 10, 2 );
-
-// Production databases set the home values in corresponding site options tables.
-// However, sites that use jquery-static-index.php cause index pages
-// to redirect to live sites in local development. This filter does not
-// prevent the redirect, but changes the redirect to the local site.
-if (JQUERY_STAGING && JQUERY_STAGING_PREFIX && JQUERY_LIVE_SITE) {
- add_filter( 'option_home', function( $value ) {
- return str_replace( '//' . JQUERY_LIVE_SITE, '//' . JQUERY_STAGING_PREFIX . JQUERY_LIVE_SITE, $value );
- } );
-}
-
if ( JQUERY_STAGING_PREFIX === 'local.' && !defined( 'XMLRPC_REQUEST' ) ) {
ob_start( 'jquery_com_ob_local_urls' );
}
diff --git a/sites.php b/sites.php
index 50c79ca5..771b9e3a 100644
--- a/sites.php
+++ b/sites.php
@@ -363,7 +363,7 @@ function jquery_sites() {
}
function jquery_default_site_options() {
- return array(
+ $defaults = array(
'enable_xmlrpc' => 1,
'template' => 'jquery',
'blogdescription' => '',
@@ -378,4 +378,14 @@ function jquery_default_site_options() {
'thread_comments' => 0,
);
+ // Production databases set the home values in corresponding site options tables.
+ // However, sites that use jquery-static-index.php cause index pages
+ // to redirect to live sites in local development. This filter does not
+ // prevent the redirect, but changes the redirect to the local site.
+ if ( JQUERY_STAGING ) {
+ $defaults['home'] = '//' . JQUERY_STAGING_PREFIX . JQUERY_LIVE_SITE;
+ $defaults['siteurl'] = '//' . JQUERY_STAGING_PREFIX . JQUERY_LIVE_SITE;
+ }
+ return $defaults;
+
}
From 06431b5780a7f59497e84c0964ff01147cb317ed Mon Sep 17 00:00:00 2001
From: Timo Tijhof
Date: Fri, 6 Oct 2023 20:48:27 -0700
Subject: [PATCH 002/126] All: Factor out jquery_site_expand() and
jquery_site_extract()
Avoid direct use JQUERY_STAGING_PREFIX so that the next commit
can replace that with a different system that can accomodate a port
number for jquery-wp-docker.
---
config.php | 7 ++-----
install.php | 4 ++--
plugins/jquery-filters.php | 6 +++---
sites.php | 33 +++++++++++++++++++++++++++++++--
sunrise.php | 4 ++--
5 files changed, 40 insertions(+), 14 deletions(-)
diff --git a/config.php b/config.php
index 25da9b45..603a49ff 100644
--- a/config.php
+++ b/config.php
@@ -33,10 +33,7 @@
}
// Strip custom port number or staging prefix
// e.g. local.jquery.com:8080 -> jquery.com
-$live_site = preg_replace( '/:\d+$/', '', strtolower( $_SERVER['HTTP_HOST'] ) );
-if ( JQUERY_STAGING ) {
- $live_site = strtr( $live_site, [ JQUERY_STAGING_PREFIX => '' ] );
-}
+$live_site = jquery_site_extract( $_SERVER['HTTP_HOST'] );
if ( !isset( $sites[ $live_site ] ) ) {
header( "400 Invalid Request" );
header( "Content-Type: text/plain" );
@@ -61,7 +58,7 @@
define( 'MULTISITE', true );
define( 'SUNRISE', true );
define( 'SUBDOMAIN_INSTALL', true );
-define( 'DOMAIN_CURRENT_SITE', JQUERY_STAGING_PREFIX . 'jquery.com' );
+define( 'DOMAIN_CURRENT_SITE', jquery_site_expand( 'jquery.com' ) );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
diff --git a/install.php b/install.php
index f11b0b52..962ffba8 100644
--- a/install.php
+++ b/install.php
@@ -17,7 +17,7 @@ function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated
global $wpdb;
$base = '/';
- $domain = JQUERY_STAGING_PREFIX . 'jquery.com';
+ $domain = jquery_site_expand( 'jquery.com' );
wp_check_mysql_version();
wp_cache_flush();
@@ -82,7 +82,7 @@ function jquery_install_site( $site, $user ) {
// sites in the exact order that they are defined, and without any gaps, as otherwise
// the "next" inserted ID would not match what we declare in jquery_sites()
//
- // $blog_id = insert_blog( JQUERY_STAGING_PREFIX . $domain, $path, 1 );
+ // $blog_id = insert_blog( jquery_site_expand( $domain ), $path, 1 );
//
// WordPress 5.1, deprecates insert_blog() in favour of a new wp_insert_site() function,
// which does accept a custom 'blog_id' to be set up front.
diff --git a/plugins/jquery-filters.php b/plugins/jquery-filters.php
index 3f4482de..118d96fb 100644
--- a/plugins/jquery-filters.php
+++ b/plugins/jquery-filters.php
@@ -148,16 +148,16 @@ function strip_https($url) {
return $post_data;
}, 10, 2 );
-if ( JQUERY_STAGING_PREFIX === 'local.' && !defined( 'XMLRPC_REQUEST' ) ) {
+if ( JQUERY_STAGING && !defined( 'XMLRPC_REQUEST' ) ) {
ob_start( 'jquery_com_ob_local_urls' );
}
function jquery_com_ob_local_urls( $content ) {
$pairs = [];
foreach ( jquery_sites() as $site => $_ ) {
// Replace HTTPS with protocol-relative so navigation stays within HTTP locally.
- $pairs[ 'https://' . $site ] = '//' . JQUERY_STAGING_PREFIX . $site;
+ $pairs[ 'https://' . $site ] = '//' . jquery_site_expand( $site );
// Update any remaining HTTP or protocol-relative urls.
- $pairs[ '//' . $site ] = '//' . JQUERY_STAGING_PREFIX . $site;
+ $pairs[ '//' . $site ] = '//' . jquery_site_expand( $site );
}
return strtr( $content, $pairs );
}
diff --git a/sites.php b/sites.php
index 771b9e3a..8e74a4d7 100644
--- a/sites.php
+++ b/sites.php
@@ -362,6 +362,35 @@ function jquery_sites() {
return $sites;
}
+/**
+ * Resolve a canonical site (e.g. JQUERY_LIVE_SITE) into one for
+ * the current environment. This exists to automatically change
+ * the site hostname if JQUERY_STAGING is true.
+ *
+ * This is cheap and can be applied at the last minute as-needed.
+ *
+ * @param string $site
+ * @return string
+ */
+function jquery_site_expand( $site ) {
+ if ( JQUERY_STAGING ) {
+ return JQUERY_STAGING_PREFIX . $site;
+ }
+ return $site;
+}
+
+/**
+ * @param string $site E.g. `$_SERVER['HTTP_HOST']`
+ * @return string
+ */
+function jquery_site_extract( $hostname ) {
+ $live_site = preg_replace( '/:\d+$/', '', strtolower( $hostname ) );
+ if ( JQUERY_STAGING ) {
+ $live_site = strtr( $live_site, [ JQUERY_STAGING_PREFIX => '' ] );
+ }
+ return $live_site;
+}
+
function jquery_default_site_options() {
$defaults = array(
'enable_xmlrpc' => 1,
@@ -383,8 +412,8 @@ function jquery_default_site_options() {
// to redirect to live sites in local development. This filter does not
// prevent the redirect, but changes the redirect to the local site.
if ( JQUERY_STAGING ) {
- $defaults['home'] = '//' . JQUERY_STAGING_PREFIX . JQUERY_LIVE_SITE;
- $defaults['siteurl'] = '//' . JQUERY_STAGING_PREFIX . JQUERY_LIVE_SITE;
+ $defaults['home'] = '//' . jquery_site_expand( JQUERY_LIVE_SITE );
+ $defaults['siteurl'] = '//' . jquery_site_expand( JQUERY_LIVE_SITE );
}
return $defaults;
diff --git a/sunrise.php b/sunrise.php
index 14a845b8..8189d696 100644
--- a/sunrise.php
+++ b/sunrise.php
@@ -54,7 +54,7 @@
}
require ABSPATH . 'wp-admin/includes/upgrade.php';
$sites = jquery_sites();
- $site = str_replace( JQUERY_STAGING_PREFIX, '', $_SERVER['HTTP_HOST'] );
+ $site = jquery_site_extract( $_SERVER['HTTP_HOST'] );
if ( ! empty( $sites[ $site ]['subsites'] ) ) {
list( $first_path_segment ) = explode( '/', trim( $_SERVER['REQUEST_URI'], '/' ), 2 );
if ( $first_path_segment && isset( $sites[ $site . '/' . $first_path_segment ] ) )
@@ -62,7 +62,7 @@
}
jquery_install_site( $site, $super_admin );
- wp_safe_redirect( 'http://' . JQUERY_STAGING_PREFIX . $site );
+ wp_safe_redirect( 'http://' . jquery_site_expand( $site ) );
exit;
} );
}
From 193e312a15038067727a3734d1820c0baa608a55 Mon Sep 17 00:00:00 2001
From: Timo Tijhof
Date: Fri, 6 Oct 2023 21:12:19 -0700
Subject: [PATCH 003/126] All: Implement JQUERY_STAGING_FORMAT to support
custom ports
---
config.php | 8 ++++----
sites.php | 12 ++++++++++--
wp-config-sample.php | 2 +-
3 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/config.php b/config.php
index 603a49ff..179a941b 100644
--- a/config.php
+++ b/config.php
@@ -4,11 +4,11 @@
if ( !defined( 'JQUERY_STAGING' ) ) {
define( 'JQUERY_STAGING', true );
}
-if ( !defined( 'JQUERY_STAGING_PREFIX' ) ) {
- define( 'JQUERY_STAGING_PREFIX', 'local.' );
+if ( !defined( 'JQUERY_STAGING_FORMAT' ) ) {
+ define( 'JQUERY_STAGING_FORMAT', JQUERY_STAGING ? 'local.%s' : '' );
}
-if ( !JQUERY_STAGING && JQUERY_STAGING_PREFIX ) {
- die( 'Error: JQUERY_STAGING_PREFIX must be empty on production domains' );
+if ( !JQUERY_STAGING && JQUERY_STAGING_FORMAT ) {
+ die( 'Error: JQUERY_STAGING_FORMAT must be empty on production domains' );
}
// Custom settings for WordPress
diff --git a/sites.php b/sites.php
index 8e74a4d7..650621cd 100644
--- a/sites.php
+++ b/sites.php
@@ -374,7 +374,7 @@ function jquery_sites() {
*/
function jquery_site_expand( $site ) {
if ( JQUERY_STAGING ) {
- return JQUERY_STAGING_PREFIX . $site;
+ return strtr( JQUERY_STAGING_FORMAT, [ '%s' => $site ] );
}
return $site;
}
@@ -386,7 +386,15 @@ function jquery_site_expand( $site ) {
function jquery_site_extract( $hostname ) {
$live_site = preg_replace( '/:\d+$/', '', strtolower( $hostname ) );
if ( JQUERY_STAGING ) {
- $live_site = strtr( $live_site, [ JQUERY_STAGING_PREFIX => '' ] );
+ // Convert the format into a regex that matches the placeholder
+ // Strip port from both because the webserver may internally have
+ // a different port from the public one
+ $rPortless = preg_quote( preg_replace( '/:\d+$/', '', JQUERY_STAGING_FORMAT ), '/' );
+ $rPortless = strtr( $rPortless, [ '%s' => '(.+)' ] );
+ $rPortless = "/^{$rPortless}$/";
+ if ( preg_match( $rPortless, $live_site, $m ) ) {
+ $live_site = $m[1];
+ }
}
return $live_site;
}
diff --git a/wp-config-sample.php b/wp-config-sample.php
index a686d2b2..0a19ca1c 100644
--- a/wp-config-sample.php
+++ b/wp-config-sample.php
@@ -8,7 +8,7 @@
*/
define( 'JQUERY_STAGING', true );
-define( 'JQUERY_STAGING_PREFIX', 'local.' );
+define( 'JQUERY_STAGING_FORMAT', 'local.%s' );
// WordPress debugging mode (enables PHP E_NOTICE and WordPress notices)
define( 'WP_DEBUG', (bool) JQUERY_STAGING );
From 78b49797334d49a02ac7ea7c7a04cfa24b30c149 Mon Sep 17 00:00:00 2001
From: Timo Tijhof
Date: Mon, 9 Oct 2023 14:09:53 -0700
Subject: [PATCH 004/126] All: Move searchform styles to base.css
These are not specific to algolia-docsearch.
Ref https://github.com/jquery/infrastructure-puppet/issues/33
---
themes/jquery/css/base.css | 7 +++++++
themes/jquery/css/docsearch.css | 7 -------
themes/jquery/header.php | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/themes/jquery/css/base.css b/themes/jquery/css/base.css
index 1e3fa0eb..fec80806 100644
--- a/themes/jquery/css/base.css
+++ b/themes/jquery/css/base.css
@@ -1659,6 +1659,13 @@ nav#main .searchform {
padding: 0;
border-radius: 20px;
position: relative;
+ text-shadow: none;
+}
+
+/* Increase invisible click area to focus search field */
+.searchform label {
+ width: 100%;
+ display: block;
}
nav#main .searchform input {
diff --git a/themes/jquery/css/docsearch.css b/themes/jquery/css/docsearch.css
index 96f93107..fbc968d6 100644
--- a/themes/jquery/css/docsearch.css
+++ b/themes/jquery/css/docsearch.css
@@ -1,12 +1,5 @@
/* Custom DocSeach CSS to adapt the generic one * See https://community.algolia.com/docsearch/styling.html for more info */
-nav#main .searchform {
- text-shadow: none;
-}
-.searchform label {
- width: 100%;
- display: block;
-}
.algolia-autocomplete {
width: 99%;
diff --git a/themes/jquery/header.php b/themes/jquery/header.php
index 8a7753b8..cad27f8c 100755
--- a/themes/jquery/header.php
+++ b/themes/jquery/header.php
@@ -18,7 +18,7 @@
-
+
From 234e75e44c9deafb70553c744b4702eebdeb48d4 Mon Sep 17 00:00:00 2001
From: Timo Tijhof
Date: Wed, 11 Oct 2023 14:32:31 -0700
Subject: [PATCH 005/126] All: Add rel=canonical links on content pages
---
plugins/jquery-actions.php | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/plugins/jquery-actions.php b/plugins/jquery-actions.php
index f015e1e2..8f708704 100644
--- a/plugins/jquery-actions.php
+++ b/plugins/jquery-actions.php
@@ -9,12 +9,36 @@
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
-remove_action( 'wp_head', 'rel_canonical' );
// Remove shortlink and header.
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10 );
remove_action( 'template_redirect', 'wp_shortlink_header', 11 );
+/**
+ * Add rel=canonical on singular pages (API pages, and blog posts)
+ *
+ * Derived from WordPress 6.3.1 rel_canonical:
+ *
+ * - Avoid applying esc_url and its 'clean_url' filter so that
+ * 'https://' is not stripped, and thus the URL is actually canonical.
+ */
+function jq_rel_canonical() {
+ if ( !is_singular() ) {
+ return;
+ }
+ $id = get_queried_object_id();
+ if ( $id === 0 ) {
+ return;
+ }
+
+ $url = wp_get_canonical_url( $id );
+ if ( $url) {
+ echo '' . "\n";
+ }
+}
+remove_action( 'wp_head', 'rel_canonical' );
+add_action( 'wp_head', 'jq_rel_canonical' );
+
// Add rel=me link to HTML head for Mastodon domain verification
//
// Usage:
From 7b0e2015d40784c37178c921d6ac1fe2be6724ce Mon Sep 17 00:00:00 2001
From: Timo Tijhof
Date: Wed, 11 Oct 2023 19:13:41 -0700
Subject: [PATCH 006/126] All: Fix invalid URLs in sitemap
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
https://github.com/jquery/jquerymobile.com/actions/runs/6490030580/job/17625221359
```
DEBUG:scrapy.core.engine:Crawled (200) (referer: None)
ERROR:scrapy.core.scraper:Spider error processing (referer: None)
Traceback (most recent call last):
…
File "/home/seleuser/.local/share/virtualenvs/seleuser-AdYDHarm/lib/python3.10/site-packages/scrapy/spiders/sitemap.py"
in _parse_sitemap
File "/home/seleuser/.local/share/virtualenvs/seleuser-AdYDHarm/lib/python3.10/site-packages/scrapy/http/request/__init__.py"
in self._set_url(url)
File "/home/seleuser/.local/share/virtualenvs/seleuser-AdYDHarm/lib/python3.10/site-packages/scrapy/http/request/__init__.py"
in _set_url
ValueError: Missing scheme in request url: //api.jquerymobile.com/wp-sitemap-posts-post-1.xml
2023-10-12 01:21:37 [scrapy.core.scraper] ERROR: Spider error processing (referer: None)
```
Ref https://github.com/jquery/infrastructure-puppet/issues/33
---
CONTRIBUTING.md | 19 +++++++++++-
plugins/jquery-actions.php | 61 +++++++++++++++-----------------------
plugins/jquery-filters.php | 12 --------
3 files changed, 42 insertions(+), 50 deletions(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9911e779..089b211a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,5 +1,22 @@
-Welcome! Thanks for your interest in contributing to jquery-wp-content. You're **almost** in the right place. More information on how to contribute to this and all other jQuery Foundation projects is over at [contribute.jquery.org](https://contribute.jquery.org). You'll definitely want to take a look at the articles on contributing [to our websites](https://contribute.jquery.org/web-sites/) and [code](https://contribute.jquery.org/code).
+# Contributing
+
+Welcome! Thanks for your interest in contributing to jquery-wp-content. More information on how to contribute to this and other projects is over at [contribute.jquery.org](https://contribute.jquery.org). You'll definitely want to take a look at the articles on contributing [to our websites](https://contribute.jquery.org/web-sites/) and [code](https://contribute.jquery.org/code).
You may also want to take a look at our [commit & pull request guide](https://contribute.jquery.org/commits-and-pull-requests/) and [style guides](https://contribute.jquery.org/style-guide/) for instructions on how to maintain your fork and submit your code. Before we can merge any pull request, we'll also need you to sign our [contributor license agreement](https://contribute.jquery.org/cla).
You can [Chat on Gitter](https://gitter.im/jquery/dev), should you have any questions. If you've never contributed to open source before, we've put together [a short guide with tips, tricks, and ideas on getting started](https://contribute.jquery.org/open-source/).
+
+## Code knowledge
+
+### Protocol-relative URLs
+
+As of 2023, we run with the default WordPress settings to formatting and cleaning URLs. If revisiting this in the future, consider the following constraints:
+
+* When accessing sites in older browsers over HTTP instead of HTTPS, references to theme assets (e.g. stylesheets) must either use the current scheme, or use a protocol-relative URL, or be an absolute path URL without protocol or hostname (`theme_root_uri`).
+
+* Intra-site links to pages and categories should generally use a path or the canonical URL.
+
+* Avoid stripping the protocol from a `clean_url` filter as various uses require a full URL:
+ * Server-side requests, such as for `downloads.wordpress.org`, must specify an explicit protocol in the URL.
+ * When building `/wp-sitemap.xml`, URLs must be full and with the canonical protocol explicitly set. Sitemaps are invalid if they contain relative URLs.
+ * When outputting `` via `wp_head/rel_canonical`, the URL must be full and canonical. Or `rel_canonical` must be remove_action'ed replaced with a custom version that calls `esc_attr()` instead of `esc_url()` to avoid the `clean_url` filter.
diff --git a/plugins/jquery-actions.php b/plugins/jquery-actions.php
index 8f708704..7fa17269 100644
--- a/plugins/jquery-actions.php
+++ b/plugins/jquery-actions.php
@@ -14,47 +14,34 @@
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10 );
remove_action( 'template_redirect', 'wp_shortlink_header', 11 );
+// Ensure relative links remain on the current protocol
+// (such as references to theme assets and intra-site links).
+// This does not influence 'home' and 'siteurl' options, and thus
+// does not affect and sitemap output.
+if ( @$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) {
+ $_SERVER['HTTPS'] = '1';
+} elseif ( @$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'http' ) {
+ $_SERVER['HTTPS'] = '0';
+}
+
/**
- * Add rel=canonical on singular pages (API pages, and blog posts)
+ * Add rel=me link to HTML head for Mastodon domain verification
+ *
+ * Usage:
+ *
+ * Put one or more comma-separated URLs in the 'jquery_xfn_rel_me' WordPress option.
+ *
+ * Example:
+ *
+ * 'jquery_xfn_rel_me' => 'https://example.org/@foo,https://social.example/@bar'
*
- * Derived from WordPress 6.3.1 rel_canonical:
+ * See also:
*
- * - Avoid applying esc_url and its 'clean_url' filter so that
- * 'https://' is not stripped, and thus the URL is actually canonical.
+ * - https://docs.joinmastodon.org/user/profile/#verification
+ * - https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/me
+ * - https://microformats.org/wiki/rel-me
+ * - https://gmpg.org/xfn/
*/
-function jq_rel_canonical() {
- if ( !is_singular() ) {
- return;
- }
- $id = get_queried_object_id();
- if ( $id === 0 ) {
- return;
- }
-
- $url = wp_get_canonical_url( $id );
- if ( $url) {
- echo '' . "\n";
- }
-}
-remove_action( 'wp_head', 'rel_canonical' );
-add_action( 'wp_head', 'jq_rel_canonical' );
-
-// Add rel=me link to HTML head for Mastodon domain verification
-//
-// Usage:
-//
-// Put one or more comma-separated URLs in the 'jquery_xfn_rel_me' WordPress option.
-//
-// Example:
-//
-// 'jquery_xfn_rel_me' => 'https://example.org/@foo,https://social.example/@bar'
-//
-// See also:
-//
-// - https://docs.joinmastodon.org/user/profile/#verification
-// - https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/me
-// - https://microformats.org/wiki/rel-me
-// - https://gmpg.org/xfn/
function jquery_xfnrelme_wp_head() {
$option = get_option( 'jquery_xfn_rel_me' , '' );
$links = $option !== '' ? explode( ',', $option ) : array();
diff --git a/plugins/jquery-filters.php b/plugins/jquery-filters.php
index 118d96fb..7860cbe7 100644
--- a/plugins/jquery-filters.php
+++ b/plugins/jquery-filters.php
@@ -120,18 +120,6 @@ function jquery_unfiltered_html_for_term_descriptions() {
return $sortedTerms;
}, 20, 3 );
-// Strip protocol from urls making them protocol agnostic.
-add_filter( 'theme_root_uri', 'strip_https', 10, 1 );
-add_filter( 'clean_url', 'strip_https', 11, 1 );
-function strip_https($url) {
- // WordPress core updates need a protocol.
- if ( 'downloads.wordpress.org' === parse_url( $url, PHP_URL_HOST ) ) {
- return $url;
- }
-
- return preg_replace( '/^https?:/', '', $url );
-}
-
add_filter( 'xmlrpc_wp_insert_post_data', function ( $post_data, $content_struct ) {
if ( $post_data['post_type'] !== 'page' ) {
return $post_data;
From 32842d2318bcddc0d7ddb20fc934edf8b2787d6b Mon Sep 17 00:00:00 2001
From: Timo Tijhof
Date: Thu, 12 Oct 2023 12:58:33 -0700
Subject: [PATCH 007/126] jquerymobile.com: deduplicate banner styles
* Fix margin being incorrect. It currently obscures part of the site
navigation due to margin-top:20px, whereas ``#banner-secondary` uses
a different amount based on the viewport width, which in turn
corresponds to the content area padding being the same amount as well.
* Fix link being dark green instead of light blue (as
taken care of by `#banner-secondary a`).
---
themes/jquerymobile.com/style.css | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/themes/jquerymobile.com/style.css b/themes/jquerymobile.com/style.css
index 01de84fa..c2e31a50 100755
--- a/themes/jquerymobile.com/style.css
+++ b/themes/jquerymobile.com/style.css
@@ -29,24 +29,8 @@ a, .title, .entry-title { color: #108040; }
padding-right: 362px;
}
-#banner-jquery-mobile-no-support {
- background-image: url(../jquery/images/dark-grey-tile.png);
- color: #fff;
+.banner-jquery-mobile-no-support {
text-align: center;
- margin: -25px;
- padding: 20px;
-}
-
-#banner-jquery-mobile-no-support h2 {
- color: #fff;
- font-size: 36px;
- line-height: 42px;
-}
-
-#banner-jquery-mobile-no-support p {
- font: 22px/26px "Helvetica Neue", Helvetica, Arial, Geneva, sans-serif;
- padding-left: 15%;
- padding-right: 15%;
}
.content-full #content #banner-secondary h1 {
From 81ad4851e28fa24d5a34916411b1753e1ee397e1 Mon Sep 17 00:00:00 2001
From: Timo Tijhof
Date: Mon, 9 Oct 2023 14:10:40 -0700
Subject: [PATCH 008/126] All: Integrate typesense-minibar and enable for
local/stage sites
To update this checked in dependency in the future, change the
number in composer.json and run `composer deps`.
Ref https://github.com/jquery/infrastructure-puppet/issues/33.
---
NOTICE.txt | 4 +
composer.json | 6 +-
sites.php | 28 ++
themes/jquery.com/style.css | 2 -
themes/jquery/css/base.css | 103 ++++----
themes/jquery/css/docsearch.css | 52 +++-
themes/jquery/footer-mobile.php | 2 +-
themes/jquery/footer-ui.php | 2 +-
themes/jquery/footer.php | 2 +-
themes/jquery/functions.jquery.php | 32 ++-
themes/jquery/header.php | 15 +-
.../jquery/lib/typesense-minibar/LICENSE.txt | 19 ++
.../typesense-minibar/typesense-minibar.css | 240 ++++++++++++++++++
.../typesense-minibar/typesense-minibar.js | 169 ++++++++++++
themes/jquery/searchform.php | 15 ++
15 files changed, 622 insertions(+), 69 deletions(-)
create mode 100644 themes/jquery/lib/typesense-minibar/LICENSE.txt
create mode 100644 themes/jquery/lib/typesense-minibar/typesense-minibar.css
create mode 100644 themes/jquery/lib/typesense-minibar/typesense-minibar.js
diff --git a/NOTICE.txt b/NOTICE.txt
index 4653ece0..b8b58fa0 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -31,3 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
- TinyNav.js
http://tinynav.com/
located at themes/jquery/js/plugins.js
+
+- typesense-minibar
+ https://github.com/jquery/typesense-minibar
+ located at themes/jquery/lib/typesense-minibar.js
diff --git a/composer.json b/composer.json
index 16947f0e..1367d735 100644
--- a/composer.json
+++ b/composer.json
@@ -6,6 +6,10 @@
"php-parallel-lint/php-parallel-lint": "1.3.2"
},
"scripts": {
- "test": "parallel-lint --exclude vendor/composer/autoload_static.php ."
+ "test": "parallel-lint --exclude vendor/ .",
+ "deps": [
+ "curl -O -q --output-dir themes/jquery/lib/typesense-minibar 'https://raw.githubusercontent.com/jquery/typesense-minibar/1.1.1/{typesense-minibar.css,typesense-minibar.js,LICENSE.txt}'",
+ "curl -q https://raw.githubusercontent.com/jquery/typesense-minibar/1.1.1/typesense-minibar-foot.css >> themes/jquery/lib/typesense-minibar/typesense-minibar.css"
+ ]
}
}
diff --git a/sites.php b/sites.php
index 650621cd..3ca94539 100644
--- a/sites.php
+++ b/sites.php
@@ -20,6 +20,8 @@ function jquery_sites() {
'jquery_xfn_rel_me' => 'https://social.lfx.dev/@jquery',
'jquery_docsearch_api_key' => '3cfde9aca378c8aab554d5bf1b23489b',
'jquery_docsearch_index_name' => 'jquery',
+ 'jquery_typesense_key' => 'Zh8mMgohXECel9wjPwqT7lekLSG3OCgz',
+ 'jquery_typesense_collection' => 'jquery_com',
),
),
'blog.jquery.com' => array(
@@ -45,6 +47,8 @@ function jquery_sites() {
'jquery_logo_link'=> 'https://jquery.com/',
'jquery_docsearch_api_key' => '3cfde9aca378c8aab554d5bf1b23489b',
'jquery_docsearch_index_name' => 'jquery',
+ 'jquery_typesense_key' => 'Zh8mMgohXECel9wjPwqT7lekLSG3OCgz',
+ 'jquery_typesense_collection' => 'jquery_com',
),
),
'plugins.jquery.com' => array(
@@ -84,6 +88,8 @@ function jquery_sites() {
'jquery_body_class' => 'jquery-ui',
'jquery_docsearch_api_key' => '2fce35e56784bbb48c78d105739190c2',
'jquery_docsearch_index_name' => 'jqueryui',
+ 'jquery_typesense_key' => 'Zh8mMgohXECel9wjPwqT7lekLSG3OCgz',
+ 'jquery_typesense_collection' => 'jqueryui_com',
'jquery_twitter_link' => 'https://twitter.com/jqueryui',
),
),
@@ -111,6 +117,8 @@ function jquery_sites() {
'jquery_logo_link'=> 'https://jqueryui.com/',
'jquery_docsearch_api_key' => '2fce35e56784bbb48c78d105739190c2',
'jquery_docsearch_index_name' => 'jqueryui',
+ 'jquery_typesense_key' => 'Zh8mMgohXECel9wjPwqT7lekLSG3OCgz',
+ 'jquery_typesense_collection' => 'jqueryui_com',
'jquery_twitter_link' => 'https://twitter.com/jqueryui',
),
),
@@ -128,6 +136,8 @@ function jquery_sites() {
'jquery_logo_link'=> 'https://jqueryui.com/',
'jquery_docsearch_api_key' => '2fce35e56784bbb48c78d105739190c2',
'jquery_docsearch_index_name' => 'jqueryui',
+ 'jquery_typesense_key' => 'Zh8mMgohXECel9wjPwqT7lekLSG3OCgz',
+ 'jquery_typesense_collection' => 'jqueryui_com',
'jquery_twitter_link' => 'https://twitter.com/jqueryui',
),
),
@@ -145,6 +155,8 @@ function jquery_sites() {
'jquery_logo_link'=> 'https://jqueryui.com/',
'jquery_docsearch_api_key' => '2fce35e56784bbb48c78d105739190c2',
'jquery_docsearch_index_name' => 'jqueryui',
+ 'jquery_typesense_key' => 'Zh8mMgohXECel9wjPwqT7lekLSG3OCgz',
+ 'jquery_typesense_collection' => 'jqueryui_com',
'jquery_twitter_link' => 'https://twitter.com/jqueryui',
),
),
@@ -174,6 +186,8 @@ function jquery_sites() {
'jquery_body_class' => 'jquery-mobile',
'jquery_docsearch_api_key' => '207328b0f1c18555c9021d05157dd651',
'jquery_docsearch_index_name' => 'jquerymobile',
+ 'jquery_typesense_key' => 'Zh8mMgohXECel9wjPwqT7lekLSG3OCgz',
+ 'jquery_typesense_collection' => 'jquerymobile_com',
'jquery_twitter_link' => 'https://twitter.com/jquerymobile',
),
),
@@ -191,6 +205,8 @@ function jquery_sites() {
'jquery_logo_link'=> 'https://jquerymobile.com/',
'jquery_docsearch_api_key' => '207328b0f1c18555c9021d05157dd651',
'jquery_docsearch_index_name' => 'jquerymobile',
+ 'jquery_typesense_key' => 'Zh8mMgohXECel9wjPwqT7lekLSG3OCgz',
+ 'jquery_typesense_collection' => 'jquerymobile_com',
'jquery_twitter_link' => 'https://twitter.com/jquerymobile',
),
),
@@ -249,6 +265,8 @@ function jquery_sites() {
'jquery_logo_link'=> 'https://jquerymobile.com/',
'jquery_docsearch_api_key' => '207328b0f1c18555c9021d05157dd651',
'jquery_docsearch_index_name' => 'jquerymobile',
+ 'jquery_typesense_key' => 'Zh8mMgohXECel9wjPwqT7lekLSG3OCgz',
+ 'jquery_typesense_collection' => 'jquerymobile_com',
'jquery_twitter_link' => 'https://twitter.com/jquerymobile',
),
),
@@ -266,6 +284,8 @@ function jquery_sites() {
'jquery_logo_link'=> 'https://jqueryui.com/',
'jquery_docsearch_api_key' => '2fce35e56784bbb48c78d105739190c2',
'jquery_docsearch_index_name' => 'jqueryui',
+ 'jquery_typesense_key' => 'Zh8mMgohXECel9wjPwqT7lekLSG3OCgz',
+ 'jquery_typesense_collection' => 'jqueryui_com',
'jquery_twitter_link' => 'https://twitter.com/jqueryui',
),
),
@@ -283,6 +303,8 @@ function jquery_sites() {
'jquery_logo_link'=> 'https://jqueryui.com/',
'jquery_docsearch_api_key' => '2fce35e56784bbb48c78d105739190c2',
'jquery_docsearch_index_name' => 'jqueryui',
+ 'jquery_typesense_key' => 'Zh8mMgohXECel9wjPwqT7lekLSG3OCgz',
+ 'jquery_typesense_collection' => 'jqueryui_com',
'jquery_twitter_link' => 'https://twitter.com/jqueryui',
),
),
@@ -300,6 +322,8 @@ function jquery_sites() {
'jquery_logo_link'=> 'https://jqueryui.com/',
'jquery_docsearch_api_key' => '2fce35e56784bbb48c78d105739190c2',
'jquery_docsearch_index_name' => 'jqueryui',
+ 'jquery_typesense_key' => 'Zh8mMgohXECel9wjPwqT7lekLSG3OCgz',
+ 'jquery_typesense_collection' => 'jqueryui_com',
'jquery_twitter_link' => 'https://twitter.com/jqueryui',
),
),
@@ -317,6 +341,8 @@ function jquery_sites() {
'jquery_logo_link'=> 'https://jquerymobile.com/',
'jquery_docsearch_api_key' => '207328b0f1c18555c9021d05157dd651',
'jquery_docsearch_index_name' => 'jquerymobile',
+ 'jquery_typesense_key' => 'Zh8mMgohXECel9wjPwqT7lekLSG3OCgz',
+ 'jquery_typesense_collection' => 'jquerymobile_com',
'jquery_twitter_link' => 'https://twitter.com/jquerymobile',
),
),
@@ -347,6 +373,8 @@ function jquery_sites() {
'jquery_logo_link'=> 'https://jqueryui.com/',
'jquery_docsearch_api_key' => '2fce35e56784bbb48c78d105739190c2',
'jquery_docsearch_index_name' => 'jqueryui',
+ 'jquery_typesense_key' => 'Zh8mMgohXECel9wjPwqT7lekLSG3OCgz',
+ 'jquery_typesense_collection' => 'jqueryui_com',
'jquery_twitter_link' => 'https://twitter.com/jqueryui',
),
),
diff --git a/themes/jquery.com/style.css b/themes/jquery.com/style.css
index 81533e09..53248797 100755
--- a/themes/jquery.com/style.css
+++ b/themes/jquery.com/style.css
@@ -48,8 +48,6 @@ a,
.cross-browser .feature-box-image{
background: url('i/feature-sprites.png') -278px 0 no-repeat;
transition: all 0.4s;
- position: relative;
- z-index: 10;
}
.cross-browser .feature-box-image:hover {
transition: all 0.7s;
diff --git a/themes/jquery/css/base.css b/themes/jquery/css/base.css
index fec80806..4ebb417d 100644
--- a/themes/jquery/css/base.css
+++ b/themes/jquery/css/base.css
@@ -93,15 +93,16 @@ body {
margin: 0;
}
-::-moz-selection {
- background: #b3d4fc;
- text-shadow: none;
-}
-
::selection {
- background: #b3d4fc;
+ background: #b4efff;
text-shadow: none;
}
+.jquery-ui ::selection {
+ background: #ffddb2;
+}
+.jquery-mobile ::selection {
+ background: #c9f2c8;
+}
.chromeframe {
margin: 0.2em 0;
@@ -1602,7 +1603,7 @@ nav#main {
border-radius: 10px 10px 0 0;
border-right: 1px solid rgba(2, 2, 2, 0.28);
border-left: 1px solid rgba(2, 2, 2, 0.28);
- border-top: 1px solid rgba(250, 250, 250, 0.27);
+ border-top: 1px solid rgba(250, 250, 250, 0.14);
box-shadow: 0 0 5px rgba(1, 1, 1, 0.7);
}
@@ -1641,8 +1642,7 @@ nav#main li a {
}
nav#main li a:hover,
-nav#main li.current a,
-nav#main .searchform {
+nav#main li.current a {
background: none;
box-shadow: inset 0 0 5px rgba(0,0,0, 0.4), rgba(255,255,255,0.1) 0 1px 0;
border-radius: 4px;
@@ -1651,56 +1651,53 @@ nav#main .searchform {
text-shadow: rgba(0, 0, 0, 0.796875) 0 -1px 0, rgba(255, 255, 255, 0.296875) 0 0 10px;
}
-nav#main .searchform {
+.searchform {
float: right;
width: 28%;
- margin-top: 12px;
- margin-bottom: 12px;
- padding: 0;
- border-radius: 20px;
- position: relative;
- text-shadow: none;
}
-
-/* Increase invisible click area to focus search field */
-.searchform label {
- width: 100%;
- display: block;
+.searchform input {
+ font-family: "Lucida Grande", Lucida, Verdana, sans-serif;
}
-
-nav#main .searchform input {
- text-decoration: none;
- font: 12px/12px "Lucida Grande", Lucida, Verdana, sans-serif;
- padding: 5px 10px;
- margin: 0;
- background-color: transparent;
- border-style: none;
- color: #fff;
- line-height: 1.3;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.76);
- width: 85%;
- box-shadow: none;
-}
-
-nav#main .searchform input:focus {
+.searchform input:focus {
outline: none;
}
-nav#main .searchform input::placeholder {
- color: #fff;
+.searchform.tsmb-form {
+ --tsmb-size-radius: 5px;
+ --tsmb-size-base: 12px;
+ --tsmb-size-sm: 0.8rem;
+ --tsmb-color-base-background: var(--tsmb-color-primary50);
+ --tsmb-color-base30: #fff;
+ --tsmb-color-base50: var(--tsmb-color-primary90);
+ --tsmb-color-base90: var(--tsmb-color-primary90);
+ --tsmb-color-focus30: #666;
+ --tsmb-color-focus50: #444;
+ --tsmb-color-focus90: #ccc;
+ --tsmb-color-primary30: #333; /* jQuery Black */
+ --tsmb-color-primary50: #0769ad; /* jQuery Primary Blue */
+ --tsmb-color-primary90: #b4efff; /* oklch(0.92 0.07 228) hue=228 of #7ACEF4 (jQuery Secondary Blue) */
+ margin: 6px 0;
+ width: 30%;
}
-
-nav#main .searchform .icon-search {
- position: absolute;
- right: 10px;
- top: 3px;
- bottom: 3px;
+.jquery-ui .searchform.tsmb-form {
+ --tsmb-color-primary50: #b24926; /* jQuery UI Secondary Orange */
+ --tsmb-color-primary90: #ffddb2; /* = #b4efff + oklch(hue=70) of #FAA523 (jQuery UI Primary Orange) */
+}
+.jquery-mobile .searchform.tsmb-form {
+ --tsmb-color-primary50: #108040; /* jQuery Mobile Secondary Green */
+ --tsmb-color-primary90: #c9f2c8; /* = #b4efff + oklch(hue=144) of #3EB249 (jQuery UI Primary Orange) */
+}
+.searchform.tsmb-form:not(:focus-within)::before {
+ filter: invert();
+}
+.searchform.tsmb-form input[type=search] {
border-width: 0;
- border-left: 1px solid rgba(7, 7, 7, 0.65);
- background-color: transparent;
- padding: 0 0 0 7px;
- opacity: 0.33;
- color: #fff;
+}
+.searchform.tsmb-form [role="listbox"] {
+ right: 0;
+}
+.searchform.tsmb-form [role="option"] mark {
+ border-bottom: 2px solid var(--tsmb-color-primary90);
}
#broadcast {
@@ -2840,6 +2837,9 @@ footer .books li a cite {
margin: 15px auto;
clear:both;
}
+ .searchform.tsmb-form input[type=search] {
+ border-width: 1px;
+ }
nav#main ul{
width: auto !important;
@@ -2959,8 +2959,7 @@ footer .books li a cite {
}
nav#main {
- margin-top: 15px;
- padding-top: 0;
+ padding: 0;
}
nav#main .searchform {
diff --git a/themes/jquery/css/docsearch.css b/themes/jquery/css/docsearch.css
index fbc968d6..2d67ead1 100644
--- a/themes/jquery/css/docsearch.css
+++ b/themes/jquery/css/docsearch.css
@@ -1,5 +1,55 @@
-/* Custom DocSeach CSS to adapt the generic one * See https://community.algolia.com/docsearch/styling.html for more info */
+/* Custom DocSeach CSS to adapt the generic one
+ * See https://community.algolia.com/docsearch/styling.html for more info */
+nav#main .searchform {
+ background: none;
+ box-shadow: inset 0 0 5px rgba(0,0,0, 0.4), rgba(255,255,255,0.1) 0 1px 0;
+ border: 1px solid rgba(0,0,0,0.25);
+ color: #fff;
+
+ margin-top: 12px;
+ margin-bottom: 12px;
+ padding: 0;
+ border-radius: 20px;
+ position: relative;
+}
+
+/* Increase invisible click area to focus search field */
+.searchform label {
+ width: 100%;
+ display: block;
+}
+
+nav#main .searchform input {
+ text-decoration: none;
+ padding: 5px 10px;
+ margin: 0;
+ background-color: transparent;
+ color: #fff;
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.76);
+ font-size: 12px;
+ width: 85%;
+ box-shadow: none;
+ border-style: none;
+ line-height: 1.3;
+}
+
+nav#main .searchform input::placeholder {
+ color: #fff;
+}
+
+nav#main .searchform .icon-search {
+ position: absolute;
+ right: 10px;
+ top: 3px;
+ bottom: 3px;
+ border-width: 0;
+ border-left: 1px solid rgba(7, 7, 7, 0.65);
+ background-color: transparent;
+ padding: 0 0 0 7px;
+ opacity: 0.33;
+ color: #fff;
+}
.algolia-autocomplete {
width: 99%;
diff --git a/themes/jquery/footer-mobile.php b/themes/jquery/footer-mobile.php
index c09b02a5..5eae8d94 100644
--- a/themes/jquery/footer-mobile.php
+++ b/themes/jquery/footer-mobile.php
@@ -8,7 +8,7 @@
-
+