diff options
author | Michał Górny <mgorny@gentoo.org> | 2017-09-11 16:56:07 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2017-09-11 16:56:07 +0200 |
commit | 5748da4432b60565ff27fac13e755050421bded4 (patch) | |
tree | acd1dcdb53ec69ecde785da2b8fda6eee1447bde | |
parent | Convert HTTP to HTTPS links. (diff) | |
download | bugzilla-5748da4432b60565ff27fac13e755050421bded4.tar.gz bugzilla-5748da4432b60565ff27fac13e755050421bded4.tar.bz2 bugzilla-5748da4432b60565ff27fac13e755050421bded4.zip |
Gentoo: shorten URLs in addressbar
-rw-r--r-- | extensions/Gentoo/web/gentoo.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/extensions/Gentoo/web/gentoo.js b/extensions/Gentoo/web/gentoo.js index 2f06e3969..044dac1cd 100644 --- a/extensions/Gentoo/web/gentoo.js +++ b/extensions/Gentoo/web/gentoo.js @@ -28,4 +28,23 @@ function add_arches_create() { document.Create.addarches.options[i].selected = false; } } -}
\ No newline at end of file +} + +function shorten_addressbar_url() { + if (history.state === null) { + var url = window.location; + if (url.pathname == '/show_bug.cgi') { + var searchRegex = /^[?]id=(\d+)(&(.*))?$/; + var m = url.search.match(searchRegex); + if (m !== null) { + var newUrl = m[1]; + if (m[2]) + newUrl += '?' + m[3]; + newUrl += url.hash; + history.replaceState('1', '', newUrl); + } + } + } +} + +shorten_addressbar_url(); |