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.5.4 assets/js/resultPage.js
word-games-theme-2.5.3 assets/js/resultPage.js
word-games-theme-2.5.2 assets/js/resultPage.js
word-games-theme-2.5.1 assets/js/resultPage.js
word-games-theme-2.5.0 assets/js/resultPage.js
word-games-theme-2.4.9 assets/js/resultPage.js
word-games-theme-2.4.8 assets/js/resultPage.js
word-games-theme-2.4.7 assets/js/resultPage.js
word-games-theme-2.4.6 assets/js/resultPage.js
word-games-theme-2.4.5 assets/js/resultPage.js
word-games-theme-2.4.4 assets/js/resultPage.js
word-games-theme-2.4.3 assets/js/resultPage.js
word-games-theme-2.4.2 assets/js/resultPage.js
word-games-theme-2.4.1 assets/js/resultPage.js
word-games-theme-2.4.0 assets/js/resultPage.js
word-games-theme-2.3.9 assets/js/resultPage.js
word-games-theme-2.3.8 assets/js/resultPage.js
word-games-theme-2.3.7 assets/js/resultPage.js
word-games-theme-2.3.6 assets/js/resultPage.js
word-games-theme-2.3.5 assets/js/resultPage.js