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:
authorStefan Giehl <stefan@piwik.org>2018-06-18 02:53:23 +0300
committerdiosmosis <diosmosis@users.noreply.github.com>2018-06-18 02:53:23 +0300
commiteb18603c81f7a33b59e5fd249a8f5f5e0a0dbafe (patch)
treec17a995d87e5b30c00a0f061ed72549822210649 /plugins/Overlay/javascripts/Piwik_Overlay.js
parente2969c8db403aa43a00f0ff9d18cb9734af5d5f8 (diff)
Deprecates the `historyService` along with `broadcast.init`, `broadcast.propagateAjax`, `broadcast.pageLoad` (#12363)
* deprecates broadcast.propagateAjax() * make overlay js independed from history service and some broadcast methods * deprecates historyService alogn with some broadcast methods * make popovers work in widgetized dashboard without history service * do not update overlay page/sidebar when iframe url didn't change prevents reloading data when opening a popover
Diffstat (limited to 'plugins/Overlay/javascripts/Piwik_Overlay.js')
-rw-r--r--plugins/Overlay/javascripts/Piwik_Overlay.js44
1 files changed, 25 insertions, 19 deletions
diff --git a/plugins/Overlay/javascripts/Piwik_Overlay.js b/plugins/Overlay/javascripts/Piwik_Overlay.js
index e0be6ce5c9..afcbc268ad 100644
--- a/plugins/Overlay/javascripts/Piwik_Overlay.js
+++ b/plugins/Overlay/javascripts/Piwik_Overlay.js
@@ -140,6 +140,10 @@ var Piwik_Overlay = (function () {
var location = getOverlayLocationFromHash(urlHash);
location = Overlay_Helper.decodeFrameUrl(location);
+ if (location == iframeCurrentPageNormalized) {
+ return;
+ }
+
if (!updateComesFromInsideFrame) {
var iframeUrl = iframeSrcBase;
if (location) {
@@ -186,26 +190,19 @@ var Piwik_Overlay = (function () {
}, 50);
// handle window resize
- // we manipulate broadcast.pageload because it unbinds all resize events on window
- var originalPageload = broadcast.pageload;
- broadcast.pageload = function (hash) {
- originalPageload(hash);
- $(window).resize(function () {
- adjustDimensions();
- });
- };
$(window).resize(function () {
adjustDimensions();
});
- // handle hash change
- broadcast.loadAjaxContent = hashChangeCallback;
+ angular.element(document).injector().invoke(function ($rootScope) {
+ $rootScope.$on('$locationChangeSuccess', function () {
+ hashChangeCallback(broadcast.getHash());
+ });
- broadcast._isInit = false;
- broadcast.init();
+ hashChangeCallback(broadcast.getHash());
+ });
if (window.location.href.split('#').length == 1) {
- // if there's no hash, broadcast won't trigger the callback - we have to do it here
hashChangeCallback('');
}
@@ -270,14 +267,23 @@ var Piwik_Overlay = (function () {
currentLocation = getOverlayLocationFromHash(locationParts[1]);
}
- var newLocation = Overlay_Helper.encodeFrameUrl(currentUrl);
+ var newFrameLocation = Overlay_Helper.encodeFrameUrl(currentUrl);
- if (newLocation != currentLocation) {
+ if (newFrameLocation != currentLocation) {
updateComesFromInsideFrame = true;
- // put the current iframe url in the main url to enable refresh and deep linking.
- // use disableHistory=true to make sure that the back and forward buttons can be
- // used on the iframe (which in turn notifies the parent about the location change)
- broadcast.propagateAjax('l=' + newLocation, true);
+
+ // available in global scope
+ var currentHashStr = broadcast.getHash();
+
+ if (currentHashStr.charAt(0) == '?') {
+ currentHashStr = currentHashStr.substr(1);
+ }
+
+ currentHashStr = broadcast.updateParamValue('l=' + newFrameLocation, currentHashStr);
+
+ var newLocation = window.location.href.split('#')[0] + '#?' + currentHashStr;
+ // window.location.replace changes the current url without pushing it on the browser's history stack
+ window.location.replace(newLocation);
} else {
// happens when the url is changed by hand or when the l parameter is there on page load
loadSidebar(currentUrl);