Commit 89609ee 1 parent b43c15e commit 89609ee Copy full SHA for 89609ee
File tree 2 files changed +17
-3
lines changed
2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " gregmat-buddy " : patch
3
+ ---
4
+
5
+ fixed multiple jumps from one keypress on vocab mountain
Original file line number Diff line number Diff line change 1
1
import { VIMEO_SELECTOR } from "@/constants" ;
2
2
import { waitForElement , waitForNoElement } from "@/utils" ;
3
3
4
+ function sanitizedUrl ( url : string ) {
5
+ const queryIndex = url . indexOf ( "?" ) ;
6
+
7
+ if ( queryIndex == - 1 ) return url ;
8
+
9
+ return url . substring ( 0 , queryIndex ) ;
10
+ }
11
+
4
12
export function registerLocationChange ( ) {
5
- let currentUrl = location . href ;
13
+ let currentUrl = sanitizedUrl ( location . href ) ;
6
14
7
15
setInterval ( ( ) => {
8
- if ( location . href !== currentUrl ) {
9
- currentUrl = location . href ;
16
+ const url = sanitizedUrl ( location . href ) ;
17
+ if ( url !== currentUrl ) {
18
+ currentUrl = url ;
10
19
window . dispatchEvent ( new Event ( "locationChange" ) ) ;
11
20
}
12
21
} , 500 ) ;
You can’t perform that action at this time.
0 commit comments