diff options
author | sgiehl <stefangiehl@gmail.com> | 2012-11-20 02:00:41 +0400 |
---|---|---|
committer | sgiehl <stefangiehl@gmail.com> | 2012-11-20 02:00:41 +0400 |
commit | 99793151cd6d4f318b7a011509bd421685f0537a (patch) | |
tree | 623b9521c3551d32d5eb808f57511ed38fe8e19a /plugins/Overlay/templates | |
parent | df1c54f0f7e50dfd670ab294d908e44ed4dbac44 (diff) |
refs #3359 moving ajax requests to a new ajax helper with more functionality as the old functions
git-svn-id: http://dev.piwik.org/svn/trunk@7489 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/Overlay/templates')
-rw-r--r-- | plugins/Overlay/templates/index.js | 74 |
1 files changed, 41 insertions, 33 deletions
diff --git a/plugins/Overlay/templates/index.js b/plugins/Overlay/templates/index.js index 45ec759d42..3cdc985deb 100644 --- a/plugins/Overlay/templates/index.js +++ b/plugins/Overlay/templates/index.js @@ -31,39 +31,47 @@ var Piwik_Overlay = (function() { iframeCurrentPage = currentUrl; iframeDomain = currentUrl.match(/http(s)?:\/\/(www\.)?([^\/]*)/i)[3]; - piwikHelper.abortQueueAjax(); - piwikHelper.ajaxCall('Overlay', 'renderSidebar', { - currentUrl: currentUrl - }, function(response) { - hideLoading(); - - var $response = $(response); - - var $responseLocation = $response.find('.Overlay_Location'); - var $url = $responseLocation.find('span'); - iframeCurrentPageNormalized = $url.data('normalizedUrl'); - iframeCurrentActionLabel = $url.data('label'); - $url.html(piwikHelper.addBreakpointsToUrl($url.text())); - $location.html($responseLocation.html()).show(); - $responseLocation.remove(); - - $location.find('span').hover(function() { - if (iframeDomain) { - // use addBreakpointsToUrl because it also encoded html entities - Piwik_Tooltip.show('<b>' + Piwik_Overlay_Translations.domain + ':</b> ' + - piwikHelper.addBreakpointsToUrl(iframeDomain), 'Overlay_Tooltip'); - } - }, function() { - Piwik_Tooltip.hide(); - }); - - $sidebar.empty().append($response).show(); - - if ($sidebar.find('.Overlay_NoData').size() == 0) { - $rowEvolutionLink.show(); - $transitionsLink.show() - } - }, 'html'); + globalAjaxQueue.abort(); + var ajaxRequest = new ajaxHelper(); + ajaxRequest.addParams({ + module: 'Overlay', + action: 'renderSidebar', + currentUrl: currentUrl + }, 'get'); + ajaxRequest.setCallback( + function (response) { + hideLoading(); + + var $response = $(response); + + var $responseLocation = $response.find('.Overlay_Location'); + var $url = $responseLocation.find('span'); + iframeCurrentPageNormalized = $url.data('normalizedUrl'); + iframeCurrentActionLabel = $url.data('label'); + $url.html(piwikHelper.addBreakpointsToUrl($url.text())); + $location.html($responseLocation.html()).show(); + $responseLocation.remove(); + + $location.find('span').hover(function () { + if (iframeDomain) { + // use addBreakpointsToUrl because it also encoded html entities + Piwik_Tooltip.show('<b>' + Piwik_Overlay_Translations.domain + ':</b> ' + + piwikHelper.addBreakpointsToUrl(iframeDomain), 'Overlay_Tooltip'); + } + }, function () { + Piwik_Tooltip.hide(); + }); + + $sidebar.empty().append($response).show(); + + if ($sidebar.find('.Overlay_NoData').size() == 0) { + $rowEvolutionLink.show(); + $transitionsLink.show() + } + } + ); + ajaxRequest.setFormat('html'); + ajaxRequest.send(false); } /** Adjust the dimensions of the iframe */ |