assets/js/wordfinder-home.js in word-games-theme-2.6.9 vs assets/js/wordfinder-home.js in word-games-theme-2.7.0
- old
+ new
@@ -119,101 +119,103 @@
});
};
const formElement = document.querySelector("#form");
formElement.addEventListener("submit", function (e) {
e.preventDefault();
- let quesMark = "?";
- if (rangeOfBlankTile) {
- if (!txtBox.value.includes("?")) {
- txtBox.value = txtBox.value + quesMark.repeat(rangeOfBlankTile); //
- txtBox.value = txtBox.value;
+ if (txtBox.value != "" || startsWith.value != "" || endsWith.value != "" || mustInclude.value != "" || exculdeWith.value != "" || inculdeWith.value != "" || wordLength.value != "") {
+ let quesMark = "?";
+ if (rangeOfBlankTile) {
+ if (!txtBox.value.includes("?")) {
+ txtBox.value = txtBox.value + quesMark.repeat(rangeOfBlankTile); //
+ txtBox.value = txtBox.value;
+ }
}
- }
+ document.querySelector(".fillterWrapper").classList.add("hide")
+ let selectedDictionary = document.querySelector(".select_dropDown2").value;
+ if (history.pushState) {
+ var newurl =
+ window.location.protocol +
+ "//" +
+ window.location.host +
+ window.location.pathname +
+ "?" +
+ "search" +
+ "=" +
+ txtBox.value.toLowerCase() +
+ "&" +
+ "dictionary" +
+ "=" +
+ selectedDictionary +
+ "&" +
+ "prefix" +
+ "=" +
+ startsWith.value +
+ "&" +
+ "contains" +
+ "=" +
+ mustInclude.value +
+ "&" +
+ "suffix" +
+ "=" +
+ endsWith.value +
+ "&" +
+ "exclude" +
+ "=" +
+ exculdeWith.value +
+ "&" +
+ "include" +
+ "=" +
+ inculdeWith.value +
+ "&" +
+ "length" +
+ "=" +
+ wordLength.value;
+ window.history.pushState({ path: newurl }, "", newurl);
- document.querySelector(".fillterWrapper").classList.add("hide")
- let selectedDictionary = document.querySelector(".select_dropDown2").value;
- if (history.pushState) {
- var newurl =
- window.location.protocol +
- "//" +
- window.location.host +
- window.location.pathname +
- "?" +
- "search" +
- "=" +
- txtBox.value.toLowerCase() +
- "&" +
- "dictionary" +
- "=" +
- selectedDictionary +
- "&" +
- "prefix" +
- "=" +
- startsWith.value +
- "&" +
- "contains" +
- "=" +
- mustInclude.value +
- "&" +
- "suffix" +
- "=" +
- endsWith.value +
- "&" +
- "exclude" +
- "=" +
- exculdeWith.value +
- "&" +
- "include" +
- "=" +
- inculdeWith.value +
- "&" +
- "length" +
- "=" +
- wordLength.value;
- window.history.pushState({ path: newurl }, "", newurl);
+ const params = new URLSearchParams(window.location.search);
+ serachValue = params.get("search");
+ prefixValue = params.get("prefix");
+ containsValue = params.get("contains");
+ suffixValue = params.get("suffix");
+ exculdeValue = params.get("exclude");
+ includeValue = params.get("include");
+ lengthValue = params.get("length");
+ dictonary = params.get("dictionary");
- const params = new URLSearchParams(window.location.search);
- serachValue = params.get("search");
- prefixValue = params.get("prefix");
- containsValue = params.get("contains");
- suffixValue = params.get("suffix");
- exculdeValue = params.get("exclude");
- includeValue = params.get("include");
- lengthValue = params.get("length");
- dictonary = params.get("dictionary");
-
- gtag("event", "page_view", {
- page_location: window.location.pathname + location.search,
- });
- }
-
- const paramName = 'search';
- if (new URLSearchParams(window.location.search).has(paramName)) {
- const additionalData = {
- url: "{{site.url}}",
- range: "{{page.blanktilerange}}"
+ gtag("event", "page_view", {
+ page_location: window.location.pathname + location.search,
+ });
}
- var loadJs = document.querySelector(".loaded-js");
- if (loadJs == null) {
- loadResource("/assets/css/wordfinder-result.css", additionalData, true, "text/css")
- .then((data) => {
- console.log("CSS loaded:", data);
- })
- .then(() => {
- // Load the JavaScript file after the CSS file has loaded
- loadResource("/assets/js/wordfinder.js", additionalData, true, "text/javascript")
- .then((data) => {
- console.log("JavaScript loaded:", data);
- getData(txtBox.value.toLowerCase());
- })
- .catch((error) => {
- console.error("Error loading JavaScript:", error);
- });
- })
- .catch((error) => {
- console.error("Error loading CSS:", error);
- });
+ const paramName = 'search';
+ if (new URLSearchParams(window.location.search).has(paramName)) {
+ const additionalData = {
+ url: "{{site.url}}",
+ range: "{{page.blanktilerange}}"
+ }
+ var loadJs = document.querySelector(".loaded-js");
+ if (loadJs == null) {
+ loadResource("/assets/css/wordfinder-result.css", additionalData, true, "text/css")
+ .then((data) => {
+ console.log("CSS loaded:", data);
+ })
+ .then(() => {
+ // Load the JavaScript file after the CSS file has loaded
+ loadResource("/assets/js/wordfinder.js", additionalData, true, "text/javascript")
+ .then((data) => {
+ console.log("JavaScript loaded:", data);
+ getData(txtBox.value.toLowerCase());
+ })
+ .catch((error) => {
+ console.error("Error loading JavaScript:", error);
+ });
+ })
+ .catch((error) => {
+ console.error("Error loading CSS:", error);
+ });
+ }
}
+ } else {
+ console.log("Please Enter Valid Letters.");
}
});
// Now you can use the loadScript function with additional data
function checkQueryParam() {
const urlParams = new URLSearchParams(window.location.search);