Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Aubry <matt@piwik.org>2015-10-16 09:16:31 +0300
committerMatthieu Aubry <matt@piwik.org>2015-10-16 09:16:31 +0300
commit5d59c2842cd6d8776bf0de6a3a977547451badc9 (patch)
treeeb63552af7fcd96138012d7b1fabe840fbfc7b95 /plugins
parent89f53c89fb700c57a347d7adae7cd50953a5d99a (diff)
parent4173de5328c51b7fb49b2b51bd024a3c9bc19ad8 (diff)
Merge pull request #9019 from piwik/9018_normalize_hash
normalize hash in history service before comparing
Diffstat (limited to 'plugins')
-rw-r--r--plugins/CoreHome/angularjs/history/history.service.js24
1 files changed, 15 insertions, 9 deletions
diff --git a/plugins/CoreHome/angularjs/history/history.service.js b/plugins/CoreHome/angularjs/history/history.service.js
index 2c6486a517..fdad7667ac 100644
--- a/plugins/CoreHome/angularjs/history/history.service.js
+++ b/plugins/CoreHome/angularjs/history/history.service.js
@@ -82,15 +82,10 @@
function load(hash) {
// make sure the hash is just the query parameter values, w/o a starting #, / or ? char. broadcast.pageload & $location.path should get neither
- var chars = ['#', '/', '?'];
- for (var i = 0; i != chars.length; ++i) {
- var charToRemove = chars[i];
- if (hash.charAt(0) == charToRemove) {
- hash = hash.substring(1);
- }
- }
-
- if (location.hash === '#?' + hash) {
+ hash = normalizeHash(hash);
+
+ var currentHash = normalizeHash(location.hash);
+ if (currentHash === hash) {
loadCurrentPage(); // it would not trigger a location change success event as URL is the same, call it manually
} else if (hash) {
$location.search(hash);
@@ -104,5 +99,16 @@
setTimeout(function () { $rootScope.$apply(); }, 1);
}
+
+ function normalizeHash(hash) {
+ var chars = ['#', '/', '?'];
+ for (var i = 0; i != chars.length; ++i) {
+ var charToRemove = chars[i];
+ if (hash.charAt(0) == charToRemove) {
+ hash = hash.substring(1);
+ }
+ }
+ return hash;
+ }
}
})(window, jQuery, broadcast);