third_party/subscriptions-project/swg.js
/**
 * Adds a parameter to a query string.
 * @param {string} url
 * @param {string} param
 * @param {string} value
 * @return {string}
 */
Adds a parameter to a query string.
Adds a parameter to a query string .
function addQueryParam(url, param, value) {
  const queryIndex = url.indexOf('?');
  const fragmentIndex = url.indexOf('#');
  let fragment = '';
  if (fragmentIndex != -1) {
    fragment = url.substring(fragmentIndex);
    url = url.substring(0, fragmentIndex);
  }
  if (queryIndex == -1) {
    url += '?';
  } else if (queryIndex < url.length - 1) {
    url += '&';
  }
  url += encodeURIComponent(param) + '=' + encodeURIComponent(value);
  return url + fragment;
}
function addQueryParam ( url , param , value ) { const queryIndex = url . indexOf ( '?' ) ; const fragmentIndex = url . indexOf ( '#' ) ; let fragment = '' ; if ( fragmentIndex != - 1 ) { fragment = url . substring ( fragmentIndex ) ; url = url . substring ( 0 , fragmentIndex ) ; } if ( queryIndex == - 1 ) { url += '?' ; } else if ( queryIndex < url . length - 1 ) { url += '&' ; } url += encodeURIComponent ( param ) + '=' + encodeURIComponent ( value ) ; return url + fragment ; }
Adds a parameter to a query string.
Adds a parameter to a query string .