aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-09-11 16:56:07 +0200
committerMichał Górny <mgorny@gentoo.org>2017-09-11 16:56:07 +0200
commit5748da4432b60565ff27fac13e755050421bded4 (patch)
treeacd1dcdb53ec69ecde785da2b8fda6eee1447bde /extensions
parentConvert HTTP to HTTPS links. (diff)
downloadbugzilla-5748da4432b60565ff27fac13e755050421bded4.tar.gz
bugzilla-5748da4432b60565ff27fac13e755050421bded4.tar.bz2
bugzilla-5748da4432b60565ff27fac13e755050421bded4.zip
Gentoo: shorten URLs in addressbar
Diffstat (limited to 'extensions')
-rw-r--r--extensions/Gentoo/web/gentoo.js21
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();