diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js/libtoaster.js')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/libtoaster.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js index a2a0abd45b..04264cd8ba 100644 --- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js +++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js | |||
@@ -161,6 +161,39 @@ var libtoaster = (function (){ | |||
161 | }); | 161 | }); |
162 | }; | 162 | }; |
163 | 163 | ||
164 | /* parses the query string of the current window.location to an object */ | ||
165 | function _parseUrlParams() { | ||
166 | string = window.location.search | ||
167 | string = string.substr(1); | ||
168 | stringArray = string.split ("&"); | ||
169 | obj = {}; | ||
170 | |||
171 | for (i in stringArray) { | ||
172 | keyVal = stringArray[i].split ("="); | ||
173 | obj[keyVal[0]] = keyVal[1]; | ||
174 | } | ||
175 | |||
176 | return obj; | ||
177 | }; | ||
178 | |||
179 | /* takes a flat object and outputs it as a query string | ||
180 | * e.g. the output of dumpsUrlParams | ||
181 | */ | ||
182 | function _dumpsUrlParams(obj) { | ||
183 | var str = "?"; | ||
184 | |||
185 | for (key in obj){ | ||
186 | if (!obj[key]) | ||
187 | continue; | ||
188 | |||
189 | str += key+ "="+obj[key].toString(); | ||
190 | str += "&"; | ||
191 | } | ||
192 | |||
193 | return str; | ||
194 | }; | ||
195 | |||
196 | |||
164 | return { | 197 | return { |
165 | reload_params : reload_params, | 198 | reload_params : reload_params, |
166 | startABuild : _startABuild, | 199 | startABuild : _startABuild, |
@@ -169,6 +202,8 @@ var libtoaster = (function (){ | |||
169 | getLayerDepsForProject : _getLayerDepsForProject, | 202 | getLayerDepsForProject : _getLayerDepsForProject, |
170 | editProject : _editProject, | 203 | editProject : _editProject, |
171 | debug: false, | 204 | debug: false, |
205 | parseUrlParams : _parseUrlParams, | ||
206 | dumpsUrlParams : _dumpsUrlParams, | ||
172 | } | 207 | } |
173 | })(); | 208 | })(); |
174 | 209 | ||