@alexsab-ru/scripts 0.15.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cookie.js +9 -4
- package/lib/form.js +3 -1
- package/package.json +1 -1
package/lib/cookie.js
CHANGED
|
@@ -36,7 +36,7 @@ export function cookiecook(days = 90)
|
|
|
36
36
|
let cookiecook = getCookie("cookiecook"),
|
|
37
37
|
cookiewin = document.querySelector('.cookie_notice');
|
|
38
38
|
|
|
39
|
-
if (cookiecook != "
|
|
39
|
+
if (cookiecook != "yes") {
|
|
40
40
|
|
|
41
41
|
cookiewin.classList.remove("hidden");
|
|
42
42
|
|
|
@@ -44,9 +44,14 @@ export function cookiecook(days = 90)
|
|
|
44
44
|
e.preventDefault();
|
|
45
45
|
cookiewin.classList.add("hidden");
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
date.setDate(date.getDate() + days);
|
|
49
|
-
document.cookie = "cookiecook=no; path=/; expires=" + date.toUTCString();
|
|
47
|
+
setAgreeCookie(days);
|
|
50
48
|
});
|
|
51
49
|
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function setAgreeCookie(days = 90) {
|
|
53
|
+
let date = new Date;
|
|
54
|
+
date.setDate(date.getDate() + days);
|
|
55
|
+
|
|
56
|
+
setCookie("cookiecook", "yes", { 'domain':window.location.hostname,'path':'/','expires': date.toUTCString() })
|
|
52
57
|
}
|
package/lib/form.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getCookie, setCookie, deleteCookie } from './cookie';
|
|
1
|
+
import { getCookie, setCookie, deleteCookie, setAgreeCookie } from './cookie';
|
|
2
2
|
import { createRequest } from './calltouch';
|
|
3
3
|
import { reachGoal, getFormDataObject } from './analytics';
|
|
4
4
|
|
|
@@ -164,6 +164,8 @@ async function submitForm(form){
|
|
|
164
164
|
if (!agree.checked) {
|
|
165
165
|
showErrorMes(form, "." + props.agreeSelector, "Чтобы продолжить, установите флажок");
|
|
166
166
|
return;
|
|
167
|
+
} else {
|
|
168
|
+
setAgreeCookie(90);
|
|
167
169
|
}
|
|
168
170
|
|
|
169
171
|
stateBtn(btn, "Отправляем...", true);
|