assets/js/xletter-home.js in word-games-theme-2.6.9 vs assets/js/xletter-home.js in word-games-theme-2.7.0
- old
+ new
@@ -86,13 +86,13 @@
return;
}
resourceEle.type = type;
resourceEle.async = async;
-
+
resourceEle.addEventListener("load", () => {
resolve({ status: true });
});
resourceEle.addEventListener("error", () => {
@@ -111,110 +111,113 @@
};
const formElement = document.querySelector("#form");
formElement.addEventListener("submit", function (e) {
e.preventDefault();
- 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);
+ if (txtBox.value != "" || startsWith.value != "" || endsWith.value != "" || mustInclude.value != "" || exculdeWith.value != "" || inculdeWith.value != "" || wordLength.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);
- 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,
- });
- }
+ gtag("event", "page_view", {
+ page_location: window.location.pathname + location.search,
+ });
+ }
+ const paramName = 'search';
+ if (new URLSearchParams(window.location.search).has(paramName)) {
- const paramName = 'search';
- if (new URLSearchParams(window.location.search).has(paramName)) {
-
- loadResource("/assets/css/wordfinder-result.css", true, "text/css").then((data) => {
- console.log("CSS loaded:", data);
- }).then(() => {
- // Load the JavaScript file after the CSS file has loaded
- loadResource("/assets/js/xletter-result.js", true, "text/javascript").then((data) => {
+ loadResource("/assets/css/wordfinder-result.css", true, "text/css").then((data) => {
+ console.log("CSS loaded:", data);
+ }).then(() => {
+ // Load the JavaScript file after the CSS file has loaded
+ loadResource("/assets/js/xletter-result.js", 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 JavaScript:", error);
+ console.error("Error loading CSS:", 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);
const paramName = 'search';
if (urlParams.has(paramName)) {
- loadResource("/assets/css/wordfinder-result.css", true, "text/css")
- .then((data) => {
- console.log("CSS loaded:", data);
- })
- .then(() => {
- // Load the JavaScript file after the CSS file has loaded
- loadResource("/assets/js/xletter-result.js", 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);
- });
+ loadResource("/assets/css/wordfinder-result.css", true, "text/css")
+ .then((data) => {
+ console.log("CSS loaded:", data);
+ })
+ .then(() => {
+ // Load the JavaScript file after the CSS file has loaded
+ loadResource("/assets/js/xletter-result.js", 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);
+ });
}
}
checkQueryParam();