diff options
author | Mike Greiling <mike@pixelcog.com> | 2016-08-01 04:17:19 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2016-08-25 06:11:58 +0300 |
commit | 96051549672084fabec9f67b1cf03c59e8ac3370 (patch) | |
tree | ff28832f9249c88e716f78c3a9366e2643e4d8e6 /app/assets/javascripts/lib/utils/url_utility.js | |
parent | 6fb46b604e4feebcbaa92d3d44d7616be709c0e5 (diff) |
Automatically expand hidden discussions when accessed via a permalink hash (closes #19304)
Diffstat (limited to 'app/assets/javascripts/lib/utils/url_utility.js')
-rw-r--r-- | app/assets/javascripts/lib/utils/url_utility.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/assets/javascripts/lib/utils/url_utility.js b/app/assets/javascripts/lib/utils/url_utility.js index fffbfd19745..533310cc87c 100644 --- a/app/assets/javascripts/lib/utils/url_utility.js +++ b/app/assets/javascripts/lib/utils/url_utility.js @@ -43,7 +43,7 @@ } return newUrl; }; - return w.gl.utils.removeParamQueryString = function(url, param) { + w.gl.utils.removeParamQueryString = function(url, param) { var urlVariables, variables; url = decodeURIComponent(url); urlVariables = url.split('&'); @@ -59,6 +59,16 @@ return results; })()).join('&'); }; + w.gl.utils.getLocationHash = function(url) { + var hashIndex; + if (typeof url === 'undefined') { + // Note: We can't use window.location.hash here because it's + // not consistent across browsers - Firefox will pre-decode it + url = window.location.href; + } + hashIndex = url.indexOf('#'); + return hashIndex === -1 ? null : url.substring(hashIndex + 1); + }; })(window); }).call(this); |