Sha256: 6dc2c9c90cc925f414b0da37dfc32ed904809d0eab820de3514da03093c7eda0

Contents?: true

Size: 1.19 KB

Versions: 152

Compression:

Stored size: 1.19 KB

Contents

function resultPage2(queryParams) {
  var newUrl = window.location.href;
  if (!newUrl.includes("?")) {
    setParams(queryParams);
  } else {
    setParams(queryParams);
    gtag("event", "page_view", {
      page_location: window.location.pathname + location.search,
    });
  }
}

function setParams(queryParams) {
  let url =
    window.location.protocol +
    "//" +
    window.location.host +
    "/" +
    permaLink +
    "?";
  for (queryP of queryParams) {
    var value;

    if (queryP.values.tagName == "INPUT") {
      value = queryP.values.value;
    } else if (queryP.values.tagName == "SELECT") {
      value = queryP.values.selectedIndex;
    }

    if (history.pushState) {
      var str = "&" + queryP.name + "=" + value;
      url = url + str;
    }
  }
  window.history.pushState({ path: url }, "", url);
}

function setParamValues(queryParams) {
  const params = new URLSearchParams(window.location.search);
  for (queryP of queryParams) {
    var parameter_value = params.get(queryP.name);
    if (queryP.values.tagName == "INPUT") {
      queryP.values.value = parameter_value;
    } else if (queryP.values.tagName == "SELECT") {
      queryP.values.selectedIndex = parameter_value;
    }
  }
}

Version data entries

152 entries across 152 versions & 1 rubygems

Version Path
word-games-theme-3.0.1 assets/js/resultPage.js
word-games-theme-3.0.0 assets/js/resultPage.js
word-games-theme-2.9.9 assets/js/resultPage.js
word-games-theme-2.9.8 assets/js/resultPage.js
word-games-theme-2.9.7 assets/js/resultPage.js
word-games-theme-2.9.6 assets/js/resultPage.js
word-games-theme-2.9.5 assets/js/resultPage.js
word-games-theme-2.9.4 assets/js/resultPage.js
word-games-theme-2.9.3 assets/js/resultPage.js
word-games-theme-2.9.2 assets/js/resultPage.js
word-games-theme-2.9.1 assets/js/resultPage.js
word-games-theme-2.9.0 assets/js/resultPage.js
word-games-theme-2.8.9 assets/js/resultPage.js
word-games-theme-2.8.8 assets/js/resultPage.js
word-games-theme-2.8.7 assets/js/resultPage.js
word-games-theme-2.8.6 assets/js/resultPage.js
word-games-theme-2.7.9 assets/js/resultPage.js
word-games-theme-2.7.8 assets/js/resultPage.js
word-games-theme-2.7.7 assets/js/resultPage.js
word-games-theme-2.7.6 assets/js/resultPage.js