Sha256: e4942bed46deea9e4a806416c8d7d0cf2b8a0c3261868bd1cba93254d84e086c

Contents?: true

Size: 866 Bytes

Versions: 31

Compression:

Stored size: 866 Bytes

Contents

/*
  Set the base URL of the background images
  so they load from the right path when the base
  URL of the app is not /
  Must be loaded after the css but before any of the elements have started to render.
*/

function setCssAssetBaseUrl(base_url, varName) {
  const urlVar = getComputedStyle(document.documentElement).getPropertyValue(varName)
  if (urlVar) {
    const absoluteUrlVar = urlVar.replace(/\//, (base_url + '/'));
    const root = document.querySelector(':root');
    root.style.setProperty(varName, absoluteUrlVar);
  }
}

setCssAssetBaseUrl(BASE_URL, '--kebab-url');
setCssAssetBaseUrl(BASE_URL, '--pact-kebab-url');
setCssAssetBaseUrl(BASE_URL, '--clock-url');
setCssAssetBaseUrl(BASE_URL, '--arrow-switch-url');
setCssAssetBaseUrl(BASE_URL, '--alert-url');
setCssAssetBaseUrl(BASE_URL, '--copy-url');
setCssAssetBaseUrl(BASE_URL, '--check-url');

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
pact_broker-2.112.0 public/javascripts/set-css-asset-base-url.js
pact_broker-2.111.0 public/javascripts/set-css-asset-base-url.js
pact_broker-2.109.1 public/javascripts/set-css-asset-base-url.js
pact_broker-2.109.0 public/javascripts/set-css-asset-base-url.js
pact_broker-2.108.0 public/javascripts/set-css-asset-base-url.js
pact_broker-2.107.1 public/javascripts/set-css-asset-base-url.js
pact_broker-2.107.0 public/javascripts/set-css-asset-base-url.js
pact_broker-2.107.0.beta.1 public/javascripts/set-css-asset-base-url.js
pact_broker-2.106.0 public/javascripts/set-css-asset-base-url.js
pact_broker-2.105.0 public/javascripts/set-css-asset-base-url.js
pact_broker-2.104.0 public/javascripts/set-css-asset-base-url.js
pact_broker-2.103.0 public/javascripts/set-css-asset-base-url.js
pact_broker-2.102.2 public/javascripts/set-css-asset-base-url.js
pact_broker-2.102.1 public/javascripts/set-css-asset-base-url.js
pact_broker-2.102.0 public/javascripts/set-css-asset-base-url.js
pact_broker-2.101.0 public/javascripts/set-css-asset-base-url.js
pact_broker-2.100.0 public/javascripts/set-css-asset-base-url.js
pact_broker-2.99.0 public/javascripts/set-css-asset-base-url.js
pact_broker-2.98.0 public/javascripts/set-css-asset-base-url.js
pact_broker-2.97.0 public/javascripts/set-css-asset-base-url.js