| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 var index = url.lastIndexOf('.'); | 55 var index = url.lastIndexOf('.'); |
| 56 if (index == -1) | 56 if (index == -1) |
| 57 return url; | 57 return url; |
| 58 return url.substr(0, index); | 58 return url.substr(0, index); |
| 59 } | 59 } |
| 60 | 60 |
| 61 base.uniquifyArray = function(array) | 61 base.uniquifyArray = function(array) |
| 62 { | 62 { |
| 63 var seen = {}; | 63 var seen = {}; |
| 64 var result = []; | 64 var result = []; |
| 65 $.each(array, function(index, value) { | 65 array.forEach(function(value) { |
| 66 if (seen[value]) | 66 if (seen[value]) |
| 67 return; | 67 return; |
| 68 seen[value] = true; | 68 seen[value] = true; |
| 69 result.push(value); | 69 result.push(value); |
| 70 }); | 70 }); |
| 71 return result; | 71 return result; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 base.flattenArray = function(arrayOfArrays) | 74 base.flattenArray = function(arrayOfArrays) |
| 75 { | 75 { |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 if (!match) | 254 if (!match) |
| 255 return null; | 255 return null; |
| 256 return decodeURI(match[1]) | 256 return decodeURI(match[1]) |
| 257 } | 257 } |
| 258 | 258 |
| 259 base.underscoredBuilderName = function(builderName) | 259 base.underscoredBuilderName = function(builderName) |
| 260 { | 260 { |
| 261 return builderName.replace(/[ .()]/g, '_'); | 261 return builderName.replace(/[ .()]/g, '_'); |
| 262 } | 262 } |
| 263 | 263 |
| 264 base.queryParam = function(params) |
| 265 { |
| 266 var result = [] |
| 267 Object.keys(params, function(key, value) { |
| 268 result.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); |
| 269 }); |
| 270 // FIXME: Remove the conversion of space to plus. This is just here |
| 271 // to remain compatible with jQuery.param, but there's no reason to |
| 272 // deviate from the built-in encodeURIComponent behavior. |
| 273 return result.join('&').replace(/%20/g, '+'); |
| 274 } |
| 275 |
| 264 })(); | 276 })(); |
| OLD | NEW |