diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-05-14 18:18:31 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-05-14 18:18:31 +0200 |
commit | 291c4a121e9aadcbfaaf380960f15561e853ecad (patch) | |
tree | d8244b92d752c7cb5841a24fa4882c5ae1843021 /core/js/js.js | |
parent | f08aed74d78cc2ec50dc74154c2862d054791882 (diff) | |
download | nextcloud-server-291c4a121e9aadcbfaaf380960f15561e853ecad.tar.gz nextcloud-server-291c4a121e9aadcbfaaf380960f15561e853ecad.zip |
Move query string helpers to the bundle
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/js/js.js')
-rw-r--r-- | core/js/js.js | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/core/js/js.js b/core/js/js.js index 4301298645e..cca8da8e7be 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -8,77 +8,6 @@ Object.assign(window.OC, { /* jshint camelcase: false */ /** - * Parses a URL query string into a JS map - * @param {string} queryString query string in the format param1=1234¶m2=abcde¶m3=xyz - * @return {Object.<string, string>} map containing key/values matching the URL parameters - */ - parseQueryString:function(queryString){ - var parts, - pos, - components, - result = {}, - key, - value; - if (!queryString){ - return null; - } - pos = queryString.indexOf('?'); - if (pos >= 0){ - queryString = queryString.substr(pos + 1); - } - parts = queryString.replace(/\+/g, '%20').split('&'); - for (var i = 0; i < parts.length; i++){ - // split on first equal sign - var part = parts[i]; - pos = part.indexOf('='); - if (pos >= 0) { - components = [ - part.substr(0, pos), - part.substr(pos + 1) - ]; - } - else { - // key only - components = [part]; - } - if (!components.length){ - continue; - } - key = decodeURIComponent(components[0]); - if (!key){ - continue; - } - // if equal sign was there, return string - if (components.length > 1) { - result[key] = decodeURIComponent(components[1]); - } - // no equal sign => null value - else { - result[key] = null; - } - } - return result; - }, - - /** - * Builds a URL query from a JS map. - * @param {Object.<string, string>} params map containing key/values matching the URL parameters - * @return {string} String containing a URL query (without question) mark - */ - buildQueryString: function(params) { - if (!params) { - return ''; - } - return $.map(params, function(value, key) { - var s = encodeURIComponent(key); - if (value !== null && typeof(value) !== 'undefined') { - s += '=' + encodeURIComponent(value); - } - return s; - }).join('&'); - }, - - /** * Opens a popup with the setting for an app. * @param {string} appid The ID of the app e.g. 'calendar', 'contacts' or 'files'. * @param {boolean|string} loadJS If true 'js/settings.js' is loaded. If it's a string |