Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
95fb947c
Unverified
Commit
95fb947c
authored
Nov 20, 2018
by
Benjamin Wheeler
Committed by
GitHub
Nov 20, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2325 from benjiwheeler/hash-redirect
redirect hash urls to url pathnames
parents
ac6a870a
79ae4dd5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
src/views/preview/preview.jsx
src/views/preview/preview.jsx
+17
-0
No files found.
src/views/preview/preview.jsx
View file @
95fb947c
...
...
@@ -778,6 +778,23 @@ const ConnectedPreview = connect(
mapDispatchToProps
)(
Preview
);
// replace old Scratch 2.0-style hashtag URLs with updated format
if
(
window
.
location
.
hash
)
{
let
pathname
=
window
.
location
.
pathname
;
if
(
pathname
.
substr
(
-
1
)
!==
'
/
'
)
{
pathname
=
`
${
pathname
}
/`
;
}
if
(
window
.
location
.
hash
===
'
#editor
'
)
{
history
.
replaceState
({},
document
.
title
,
`
${
pathname
}
editor
${
window
.
location
.
search
}
`
);
}
if
(
window
.
location
.
hash
===
'
#fullscreen
'
)
{
history
.
replaceState
({},
document
.
title
,
`
${
pathname
}
fullscreen
${
window
.
location
.
search
}
`
);
}
}
// initialize GUI by calling its reducer functions depending on URL
GUI
.
setAppElement
(
document
.
getElementById
(
'
app
'
));
const
initGuiState
=
guiInitialState
=>
{
const
pathname
=
window
.
location
.
pathname
.
toLowerCase
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment