Reverted addEventListener for media query (hello iOS Safari, I'm looking at you)

This commit is contained in:
squidfunk 2020-09-27 21:01:16 +02:00
parent a127eec88d
commit 0c4ddfcd70
8 changed files with 12 additions and 11 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

View File

@ -1,6 +1,6 @@
{
"assets/javascripts/bundle.js": "assets/javascripts/bundle.68692be8.min.js",
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.68692be8.min.js.map",
"assets/javascripts/bundle.js": "assets/javascripts/bundle.a50b2d70.min.js",
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.a50b2d70.min.js.map",
"assets/javascripts/vendor.js": "assets/javascripts/vendor.bdf98b33.min.js",
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.bdf98b33.min.js.map",
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.e0a2b82c.min.js",

View File

@ -173,7 +173,7 @@
</div>
{% block scripts %}
<script src="{{ 'assets/javascripts/vendor.bdf98b33.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.68692be8.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.a50b2d70.min.js' | url }}"></script>
{%- set translations = {} -%}
{%- for key in [
"clipboard.copy",

View File

@ -20,8 +20,8 @@
* IN THE SOFTWARE.
*/
import { Observable, fromEvent } from "rxjs"
import { map, shareReplay, startWith } from "rxjs/operators"
import { Observable } from "rxjs"
import { shareReplay, startWith } from "rxjs/operators"
/* ----------------------------------------------------------------------------
* Functions
@ -36,9 +36,10 @@ import { map, shareReplay, startWith } from "rxjs/operators"
*/
export function watchMedia(query: string): Observable<boolean> {
const media = matchMedia(query)
return fromEvent<MediaQueryListEvent>(media, "change")
return new Observable<boolean>(subscriber => {
media.addListener(ev => subscriber.next(ev.matches))
})
.pipe(
map(ev => ev.matches),
startWith(media.matches),
shareReplay({ bufferSize: 1, refCount: true })
)

View File

@ -83,7 +83,7 @@ export function patchScrollfix(
iif(isAppleDevice, els$, NEVER)
.pipe(
switchMap(els => merge(...els.map(el => (
fromEvent(el, "touchstart", { passive: true })
fromEvent(el, "touchstart")
.pipe(
mapTo(el)
)