| Index: third_party/polymer/v1_0/components-chromium/iron-location/iron-query-params-extracted.js
|
| diff --git a/third_party/polymer/v1_0/components-chromium/iron-location/iron-query-params-extracted.js b/third_party/polymer/v1_0/components-chromium/iron-location/iron-query-params-extracted.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8bd4de5ab770ffb33ff7ebfb89e838b733e6d706
|
| --- /dev/null
|
| +++ b/third_party/polymer/v1_0/components-chromium/iron-location/iron-query-params-extracted.js
|
| @@ -0,0 +1,68 @@
|
| +'use strict';
|
| +
|
| + Polymer({
|
| + is: 'iron-query-params',
|
| + properties: {
|
| + paramsString: {
|
| + type: String,
|
| + notify: true,
|
| + observer: 'paramsStringChanged',
|
| + },
|
| + paramsObject: {
|
| + type: Object,
|
| + notify: true,
|
| + value: function() {
|
| + return {};
|
| + }
|
| + },
|
| + _dontReact: {
|
| + type: Boolean,
|
| + value: false
|
| + }
|
| + },
|
| + hostAttributes: {
|
| + hidden: true
|
| + },
|
| + observers: [
|
| + 'paramsObjectChanged(paramsObject.*)'
|
| + ],
|
| + paramsStringChanged: function() {
|
| + this._dontReact = true;
|
| + this.paramsObject = this._decodeParams(this.paramsString);
|
| + this._dontReact = false;
|
| + },
|
| + paramsObjectChanged: function() {
|
| + if (this._dontReact) {
|
| + return;
|
| + }
|
| + this.paramsString = this._encodeParams(this.paramsObject);
|
| + },
|
| + _encodeParams: function(params) {
|
| + var encodedParams = [];
|
| + for (var key in params) {
|
| + var value = params[key];
|
| + if (value === '') {
|
| + encodedParams.push(encodeURIComponent(key));
|
| + } else if (value) {
|
| + encodedParams.push(
|
| + encodeURIComponent(key) +
|
| + '=' +
|
| + encodeURIComponent(value.toString())
|
| + );
|
| + }
|
| + }
|
| + return encodedParams.join('&');
|
| + },
|
| + _decodeParams: function(paramString) {
|
| + var params = {};
|
| + var paramList = (paramString || '').split('&');
|
| + for (var i = 0; i < paramList.length; i++) {
|
| + var param = paramList[i].split('=');
|
| + if (param[0]) {
|
| + params[decodeURIComponent(param[0])] =
|
| + decodeURIComponent(param[1] || '');
|
| + }
|
| + }
|
| + return params;
|
| + }
|
| + });
|
|
|