Skip to content
Extraits de code Groupes Projets
Valider 3d9293cb rédigé par sgiehl's avatar sgiehl
Parcourir les fichiers

fixed some jsdoc; removed some deprecated js functions that were already unused

parent 9dad6f3d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -167,7 +167,7 @@ var broadcast = {
* NOTE: this method will only make ajax call and replacing main content.
*
* @param {string} ajaxUrl querystring with parameters to be updated
* @param {boolean} disableHistory the hash change won't be available in the browser history
* @param {boolean} [disableHistory] the hash change won't be available in the browser history
* @return {void}
*/
propagateAjax: function (ajaxUrl, disableHistory) {
......@@ -224,7 +224,7 @@ var broadcast = {
* NOTE: This method will refresh the page with new values.
*
* @param {string} str url with parameters to be updated
* @param {boolean} showAjaxLoading whether to show the ajax loading gif or not.
* @param {boolean} [showAjaxLoading] whether to show the ajax loading gif or not.
* @return {void}
*/
propagateNewPage: function (str, showAjaxLoading) {
......@@ -422,7 +422,7 @@ var broadcast = {
* Return hash string if hash exists on address bar.
* else return false;
*
* @return {string|false}
* @return {string|boolean} current hash or false if it is empty
*/
isHashExists: function () {
var hashStr = broadcast.getHashFromUrl();
......@@ -438,7 +438,7 @@ var broadcast = {
* Get Hash from given url or from current location.
* return empty string if no hash present.
*
* @param {string} url
* @param {string} [url] url to get hash from (defaults to current location)
* @return {string} the hash part of the given url
*/
getHashFromUrl: function (url) {
......@@ -513,7 +513,7 @@ var broadcast = {
* Empty String if param is not found.
*
* @param {string} param parameter to search for
* @param {string} url url to check
* @param {string} [url] url to check, defaults to current location
* @return {string} value of the given param within the given url
*/
getValueFromUrl: function (param, url) {
......
......@@ -66,9 +66,9 @@ var Piwik_Popover = (function () {
/**
* Open the popover with a loading message
*
* @param popoverName string name of the popover
* @param popoverSubject string subject of the popover (e.g. url, optional)
* @param height int height of the popover in px (optional)
* @param {string} popoverName name of the popover
* @param {string} [popoverSubject] subject of the popover (e.g. url, optional)
* @param {int} [height] height of the popover in px (optional)
*/
showLoading: function (popoverName, popoverSubject, height) {
var loading = $(document.createElement('div')).addClass('Piwik_Popover_Loading');
......@@ -113,7 +113,11 @@ var Piwik_Popover = (function () {
return container;
},
/** Add a help button to the current popover */
/**
* Add a help button to the current popover
*
* @param {string} helpUrl
*/
addHelpButton: function (helpUrl) {
if (!isOpen) {
return;
......@@ -144,7 +148,13 @@ var Piwik_Popover = (function () {
centerPopover();
},
/** Show an error message. All params are HTML! */
/**
* Show an error message. All params are HTML!
*
* @param {string} title
* @param {string} [message]
* @param {string} [backLabel]
*/
showError: function (title, message, backLabel) {
var error = $(document.createElement('div')).addClass('Piwik_Popover_Error');
......@@ -172,7 +182,11 @@ var Piwik_Popover = (function () {
this.setContent(error);
},
/** Add a callback for the next time the popover is closed or the content changes */
/**
* Add a callback for the next time the popover is closed or the content changes
*
* @param {function} callback
*/
onClose: function (callback) {
closeCallback = callback;
},
......@@ -186,8 +200,8 @@ var Piwik_Popover = (function () {
/**
* Create a Popover and load the specified URL in it
* @param url
* @param loadingName
* @param {string} url
* @param {string} loadingName
*/
createPopupAndLoadUrl: function (url, loadingName) {
// open the popover
......
......@@ -475,7 +475,7 @@
/**
* Save the current layout in database if it has changed
* @param {string} action
* @param {string} [action] action to perform (defaults to saveLayout)
*/
function saveLayout(action) {
......
......@@ -64,37 +64,6 @@ widgetsHelper.getWidgetNameFromUniqueId = function (uniqueId) {
return widget["name"];
};
/**
* Returns an parameter object to be used for an jquery ajax request to fetch the widget html
*
* @param {string} widgetUniqueId unique id of the widget
* @param {object} widgetParameters parameters to be used for loading the widget
* @param {function} onWidgetLoadedCallback callback to be executed after widget is loaded
* @return {object}
* @deprecated since 1.9.3 - will be removed in next major release. use widgetsHelper.loadWidgetAjax
*/
widgetsHelper.getLoadWidgetAjaxRequest = function (widgetUniqueId, widgetParameters, onWidgetLoadedCallback) {
var token_auth = broadcast.getValueFromUrl('token_auth');
if (token_auth.length && token_auth != 'anonymous') {
widgetParameters['token_auth'] = token_auth;
}
var disableLink = broadcast.getValueFromUrl('disableLink');
if (disableLink.length) {
widgetParameters['disableLink'] = disableLink;
}
return {
widgetUniqueId: widgetUniqueId,
type: 'GET',
url: 'index.php',
dataType: 'html',
async: true,
error: piwikHelper.ajaxHandleError,
success: onWidgetLoadedCallback,
data: piwikHelper.getQueryStringFromParameters(widgetParameters) + "&widget=1&idSite=" + piwik.idSite + "&period=" + piwik.period + "&date=" + broadcast.getValueFromUrl('date') + "&token_auth=" + piwik.token_auth
};
};
/**
* Sends and ajax request to query for the widgets html
*
......
......@@ -167,7 +167,7 @@ function ajaxHelper() {
* Set callback to redirect on success handler
* &update=1(+x) will be appended to the current url
*
* @param {object} params to modify in redirect url
* @param {object} [params] to modify in redirect url
* @return {void}
*/
this.redirectOnSuccess = function (params) {
......@@ -235,7 +235,7 @@ function ajaxHelper() {
/**
* Set the div element to show while request is loading
*
* @param {String} element selector for the loading element
* @param {String} [element] selector for the loading element
*/
this.setLoadingElement = function (element) {
if (!element) {
......@@ -258,7 +258,7 @@ function ajaxHelper() {
/**
* Send the request
* @param {Boolean} sync indicates if the request should be synchronous (defaults to false)
* @param {Boolean} [sync] indicates if the request should be synchronous (defaults to false)
* @return {void}
*/
this.send = function (sync) {
......
......@@ -229,7 +229,7 @@ var piwikHelper = {
/**
* Shows the loading message with the given Id
* @param {string} loadingDivID id of the domNode (defaults to ajaxLoading)
* @param {string} [loadingDivID] id of the domNode (defaults to ajaxLoading)
* @return {void}
*/
showAjaxLoading: function(loadingDivID)
......@@ -240,7 +240,7 @@ var piwikHelper = {
/**
* Hides the loading message with the given id
* @param {string} loadingDivID id of the domNode (defaults to ajaxLoading)
* @param {string} [loadingDivID] id of the domNode (defaults to ajaxLoading)
* @return {void}
*/
hideAjaxLoading: function(loadingDivID)
......@@ -249,28 +249,6 @@ var piwikHelper = {
$('#'+loadingDivID).hide();
},
/**
* Returns default configuration for ajax requests
* @param {string} loadingDivID id of domNode used for loading message
* @param {string} errorDivID id of domNode used for error messages
* @param {object} params params used for handling response
* @return {object}
* @deprecated sine 1.9.3 - will be removed in 2.0
* @see use ajaxHelper for ajax requests
*/
getStandardAjaxConf: function(loadingDivID, errorDivID, params)
{
piwikHelper.showAjaxLoading(loadingDivID);
piwikHelper.hideAjaxError(errorDivID);
var ajaxRequest = {};
ajaxRequest.type = 'GET';
ajaxRequest.url = 'index.php';
ajaxRequest.dataType = 'json';
ajaxRequest.error = piwikHelper.ajaxHandleError;
ajaxRequest.success = function(response) { piwikHelper.ajaxHandleResponse(response, loadingDivID, errorDivID, params); };
return ajaxRequest;
},
/**
* Reloads the page after the given period
* @param {int} timeoutPeriod
......@@ -314,46 +292,6 @@ var piwikHelper = {
}, 2000);
},
/**
* Method to handle ajax response
* @param {object} response
* @param {string} loadingDivID
* @param {string} errorDivID
* @param {object} params
* @return {void}
* @deprecated since 1.9.3 - will be removed in 2.0
* @see use ajaxHelper for ajax requests
*/
ajaxHandleResponse: function(response, loadingDivID, errorDivID, params)
{
if(response.result == "error")
{
piwikHelper.hideAjaxLoading(loadingDivID);
piwikHelper.showAjaxError(response.message, errorDivID);
}
else
{
// add updated=1 to the URL so that a "Your changes have been saved" message is displayed
var urlToRedirect = piwikHelper.getCurrentQueryStringWithParametersModified(params);
var updatedUrl = new RegExp('&updated=([0-9]+)');
var updatedCounter = updatedUrl.exec(urlToRedirect);
if(!updatedCounter)
{
urlToRedirect += '&updated=1';
}
else
{
updatedCounter = 1 + parseInt(updatedCounter[1]);
urlToRedirect = urlToRedirect.replace(new RegExp('(&updated=[0-9]+)'), '&updated=' + updatedCounter);
}
var currentHashStr = window.location.hash;
if(currentHashStr.length > 0) {
urlToRedirect += currentHashStr;
}
piwikHelper.redirectToUrl(urlToRedirect);
}
},
/**
* Scrolls the window to the jquery element 'elem'
* if the top of the element is not currently visible on screen
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter