File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change 43
43
}
44
44
}
45
45
46
- function escapeCharacters ( hash ) {
46
+ function parseRawHash ( hash ) {
47
47
// Remove leading hash
48
48
if ( hash . charAt ( 0 ) === '#' ) {
49
49
hash = hash . substr ( 1 )
50
50
}
51
51
52
- return '#' + CSS . escape ( hash )
52
+ // Escape characters
53
+ try {
54
+ hash = decodeURIComponent ( hash )
55
+ } catch ( e ) { }
56
+ return CSS . escape ( hash )
53
57
}
54
58
55
59
function initLocationHashFuzzyMatching ( ) {
56
60
var rawHash = window . location . hash
57
61
if ( ! rawHash ) return
58
- var hash
59
- try {
60
- hash = escapeCharacters ( decodeURIComponent ( rawHash ) )
61
- } catch ( e ) {
62
- hash = escapeCharacters ( rawHash )
63
- }
62
+ var hash = parseRawHash ( rawHash )
64
63
var hashTarget = document . getElementById ( hash )
65
64
if ( ! hashTarget ) {
66
65
var normalizedHash = normalizeHash ( hash )
73
72
if ( distanceA > distanceB ) return 1
74
73
return 0
75
74
} )
76
- window . location . hash = encodeURIComponent ( possibleHashes [ 0 ] )
75
+ window . location . hash = '#' + possibleHashes [ 0 ]
77
76
}
78
77
79
78
function normalizeHash ( rawHash ) {
155
154
overlay . className = 'overlay'
156
155
157
156
158
- modalButton . addEventListener ( 'click' , function ( ) {
157
+ modalButton . addEventListener ( 'click' , function ( event ) {
158
+ event . stopPropagation ( )
159
159
videoModal . classList . toggle ( 'open' )
160
160
document . body . classList . toggle ( 'stop-scroll' )
161
161
document . body . appendChild ( overlay )
You can’t perform that action at this time.
0 commit comments