OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * The global object. | 6 * The global object. |
7 * @param {!Object} | 7 * @param {!Object} |
8 */ | 8 */ |
9 const global = this; | 9 const global = this; |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // quotes (") appearing in a URI must be escaped with a backslash | 48 // quotes (") appearing in a URI must be escaped with a backslash |
49 var s2 = s.replace(/(\(|\)|\,|\s|\'|\"|\\)/g, '\\$1'); | 49 var s2 = s.replace(/(\(|\)|\,|\s|\'|\"|\\)/g, '\\$1'); |
50 // WebKit has a bug when it comes to URLs that end with \ | 50 // WebKit has a bug when it comes to URLs that end with \ |
51 // https://bugs.webkit.org/show_bug.cgi?id=28885 | 51 // https://bugs.webkit.org/show_bug.cgi?id=28885 |
52 if (/\\\\$/.test(s2)) { | 52 if (/\\\\$/.test(s2)) { |
53 // Add a space to work around the WebKit bug. | 53 // Add a space to work around the WebKit bug. |
54 s2 += ' '; | 54 s2 += ' '; |
55 } | 55 } |
56 return 'url("' + s2 + '")'; | 56 return 'url("' + s2 + '")'; |
57 } | 57 } |
| 58 |
| 59 /** |
| 60 * Parses query parameters from Location. |
| 61 * @param {string} s The URL to generate the CSS url for. |
| 62 * @return {object} Dictionary containing name value pairs for URL |
| 63 */ |
| 64 function parseQueryParams(location) { |
| 65 var params = {}; |
| 66 var query = unescape(location.search.substring(1)); |
| 67 var vars = query.split("&"); |
| 68 for (var i=0; i < vars.length; i++) { |
| 69 var pair = vars[i].split("="); |
| 70 params[pair[0]] = pair[1]; |
| 71 } |
| 72 return params; |
| 73 } |
OLD | NEW |