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-2.3.4 assets/js/resultPage.js
word-games-theme-2.3.3 assets/js/resultPage.js
word-games-theme-2.3.2 assets/js/resultPage.js
word-games-theme-2.3.1 assets/js/resultPage.js
word-games-theme-2.3.0 assets/js/resultPage.js
word-games-theme-2.2.9 assets/js/resultPage.js
word-games-theme-2.2.8 assets/js/resultPage.js
word-games-theme-2.2.7 assets/js/resultPage.js
word-games-theme-2.2.6 assets/js/resultPage.js
word-games-theme-2.2.5 assets/js/resultPage.js
word-games-theme-2.2.4 assets/js/resultPage.js
word-games-theme-2.2.3 assets/js/resultPage.js
word-games-theme-2.2.2 assets/js/resultPage.js
word-games-theme-2.2.1 assets/js/resultPage.js
word-games-theme-2.2.0 assets/js/resultPage.js
word-games-theme-2.1.9 assets/js/resultPage.js
word-games-theme-2.1.8 assets/js/resultPage.js
word-games-theme-2.1.7 assets/js/resultPage.js
word-games-theme-2.1.6 assets/js/resultPage.js
word-games-theme-2.1.5 assets/js/resultPage.js