- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / resources / gaia_auth / util.js
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 function $(id) {
6   return document.getElementById(id);
7 }
8
9 function getUrlSearchParams(search) {
10   var params = {};
11
12   if (search) {
13     // Strips leading '?'
14     search = search.substring(1);
15     var pairs = search.split('&');
16     for (var i = 0; i < pairs.length; ++i) {
17       var pair = pairs[i].split('=');
18       if (pair.length == 2) {
19         params[pair[0]] = decodeURIComponent(pair[1]);
20       } else {
21         params[pair] = true;
22       }
23     }
24   }
25
26   return params;
27 }