Fixed search and details for Safari 10+

This commit is contained in:
squidfunk 2022-01-06 21:33:38 +01:00
parent 3ded01c281
commit 638d01905f
17 changed files with 76 additions and 46 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -34,7 +34,7 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block styles %} {% block styles %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.9d8e7b00.min.css' | url }}"> <link rel="stylesheet" href="{{ 'assets/stylesheets/main.8002f318.min.css' | url }}">
{% if config.theme.palette %} {% if config.theme.palette %}
{% set palette = config.theme.palette %} {% set palette = config.theme.palette %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.e6a45f82.min.css' | url }}"> <link rel="stylesheet" href="{{ 'assets/stylesheets/palette.e6a45f82.min.css' | url }}">
@ -184,7 +184,7 @@
"base": base_url, "base": base_url,
"features": features, "features": features,
"translations": {}, "translations": {},
"search": "assets/javascripts/workers/search.361d90f1.min.js" | url "search": "assets/javascripts/workers/search.c0c1e814.min.js" | url
} -%} } -%}
{%- if config.extra.version -%} {%- if config.extra.version -%}
{%- set _ = app.update({ "version": config.extra.version }) -%} {%- set _ = app.update({ "version": config.extra.version }) -%}
@ -213,7 +213,7 @@
</script> </script>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/bundle.54617339.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/bundle.d85bccd8.min.js' | url }}"></script>
{% for path in config["extra_javascript"] %} {% for path in config["extra_javascript"] %}
<script src="{{ path | url }}"></script> <script src="{{ path | url }}"></script>
{% endfor %} {% endfor %}

5
package-lock.json generated
View File

@ -1163,6 +1163,11 @@
"integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=",
"dev": true "dev": true
}, },
"array-flat-polyfill": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/array-flat-polyfill/-/array-flat-polyfill-1.0.1.tgz",
"integrity": "sha512-hfJmKupmQN0lwi0xG6FQ5U8Rd97RnIERplymOv/qpq8AoNKPPAnxJadjFA23FNWm88wykh9HmpLJUUwUtNU/iw=="
},
"array-includes": { "array-includes": {
"version": "3.1.4", "version": "3.1.4",
"resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.4.tgz", "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.4.tgz",

View File

@ -38,6 +38,7 @@
"upgrade:install": "npm install" "upgrade:install": "npm install"
}, },
"dependencies": { "dependencies": {
"array-flat-polyfill": "^1.0.1",
"clipboard": "^2.0.8", "clipboard": "^2.0.8",
"escape-html": "^1.0.3", "escape-html": "^1.0.3",
"focus-visible": "^5.2.0", "focus-visible": "^5.2.0",

View File

@ -20,6 +20,11 @@
* IN THE SOFTWARE. * IN THE SOFTWARE.
*/ */
import "array-flat-polyfill"
import "focus-visible"
import "unfetch/polyfill"
import "url-polyfill"
import { import {
EMPTY, EMPTY,
NEVER, NEVER,

View File

@ -22,6 +22,8 @@
import lunr from "lunr" import lunr from "lunr"
import "~/polyfills"
import { Search, SearchIndexConfig } from "../../_" import { Search, SearchIndexConfig } from "../../_"
import { import {
SearchMessage, SearchMessage,

View File

@ -20,12 +20,8 @@
* IN THE SOFTWARE. * IN THE SOFTWARE.
*/ */
import "focus-visible"
import "unfetch/polyfill"
import "url-polyfill"
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* Custom polyfills * Polyfills
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
/* Polyfill for `Object.entries` */ /* Polyfill for `Object.entries` */
@ -40,8 +36,20 @@ if (!Object.entries)
return data return data
} }
/* Polyfill for `Object.values` */
if (!Object.values)
Object.values = function (obj: object) {
const data: string[] = []
for (const key of Object.keys(obj))
// @ts-expect-error - ignore property access warning
data.push(obj[key])
/* Return values */
return data
}
/* Polyfill for `Element.scrollTo` */ /* Polyfill for `Element.scrollTo` */
if (!Element.prototype.scrollTo) if (typeof Element !== "undefined" && !Element.prototype.scrollTo)
Element.prototype.scrollTo = function ( Element.prototype.scrollTo = function (
x?: ScrollToOptions | number, y?: number x?: ScrollToOptions | number, y?: number
): void { ): void {

View File

@ -102,9 +102,13 @@
} }
} }
// Hide native details marker - Safari (iOS and macOS) does not seem to // Hide native details marker - modern
// like :is() on details elements, so just go with a selector list. &::marker {
&::marker, display: none;
}
// Hide native details marker - legacy, must be split into a seprate rule,
// so older browsers don't consider the selector list as invalid
&::-webkit-details-marker { &::-webkit-details-marker {
display: none; display: none;
} }

View File

@ -583,8 +583,13 @@
background-color: var(--md-accent-fg-color--transparent); background-color: var(--md-accent-fg-color--transparent);
} }
// Hide native details marker // Hide native details marker - modern
&::marker, &::marker {
display: none;
}
// Hide native details marker - legacy, must be split into a seprate rule,
// so older browsers don't consider the selector list as invalid
&::-webkit-details-marker { &::-webkit-details-marker {
display: none; display: none;
} }