Skip to content

Instantly share code, notes, and snippets.

@wilmoore
Last active September 23, 2024 12:30
Show Gist options
  • Select an option

  • Save wilmoore/c7e5818176240a0c46b5d57cc4905f48 to your computer and use it in GitHub Desktop.

Select an option

Save wilmoore/c7e5818176240a0c46b5d57cc4905f48 to your computer and use it in GitHub Desktop.
Software Engineering :: Web :: Browser :: Extension :: Development :: Gist Edit Keyboard Shortcut

Software Engineering :: Web :: Browser :: Extension :: Development :: Gist Edit Keyboard Shortcut

⪼ Made with 💜 by Polyglot.

alternative names

...

related

About

...

window.location.pathname
'/wilmoore/77bdb6a99912b2b4a585c5f347e6980b'
window.location.pathname.endsWith('/edit')
false
window.location.pathname.endsWith('/edit')
false
window.location.pathname.split
ƒ split() { [native code] }
window.location.pathname.split('/')
(3) ['', 'wilmoore', '77bdb6a99912b2b4a585c5f347e6980b']
window.location.pathname.split('/').filter(String)
(2) ['wilmoore', '77bdb6a99912b2b4a585c5f347e6980b']
window.location.pathname.split('/').filter(String).concat('edit')
(3) ['wilmoore', '77bdb6a99912b2b4a585c5f347e6980b', 'edit']
window.location.pathname.split('/').filter(String).concat('edit').join('/')
'wilmoore/77bdb6a99912b2b4a585c5f347e6980b/edit'
new URL(window.location)
URL {origin: 'https://gist.github.com', protocol: 'https:', username: '', password: '', host: 'gist.github.com', …}hash: ""host: "gist.github.com"hostname: "gist.github.com"href: "https://gist.github.com/wilmoore/77bdb6a99912b2b4a585c5f347e6980b"origin: "https://gist.github.com"password: ""pathname: "/wilmoore/77bdb6a99912b2b4a585c5f347e6980b"port: ""protocol: "https:"search: ""searchParams: URLSearchParams {size: 0}username: ""[[Prototype]]: URL
window.location.pathname.split('/').filter(String).concat('edit').join('/')
'wilmoore/77bdb6a99912b2b4a585c5f347e6980b/edit'
(new URL(window.location)).pathname
'/wilmoore/77bdb6a99912b2b4a585c5f347e6980b'
77bdb6a…:1 Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received
(new URL(window.location)).pathname = 'edit'
'edit'
let url = new URL(window.location)
undefined
url.pathname = 'edit'
'edit'
url
URL {origin: 'https://gist.github.com', protocol: 'https:', username: '', password: '', host: 'gist.github.com', …}
url.pathname = window.location.pathname.split('/').filter(String).concat('edit').join('/')
'wilmoore/77bdb6a99912b2b4a585c5f347e6980b/edit'
url
URL {origin: 'https://gist.github.com', protocol: 'https:', username: '', password: '', host: 'gist.github.com', …}hash: ""host: "gist.github.com"hostname: "gist.github.com"href: "https://gist.github.com/wilmoore/77bdb6a99912b2b4a585c5f347e6980b/edit"origin: "https://gist.github.com"password: ""pathname: "/wilmoore/77bdb6a99912b2b4a585c5f347e6980b/edit"port: ""protocol: "https:"search: ""searchParams: URLSearchParams {size: 0}username: ""[[Prototype]]: URL
  • ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment