@pushword/js-helper 0.0.62 → 0.0.63
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/package.json +1 -1
- package/src/helpers.js +9 -4
package/package.json
CHANGED
package/src/helpers.js
CHANGED
|
@@ -29,7 +29,7 @@ export function liveBlock(liveBlockAttribute = "data-live", liveFormSelector = "
|
|
|
29
29
|
|
|
30
30
|
var getLiveBlock = function (item) {
|
|
31
31
|
var url = item.getAttribute(liveBlockAttribute);
|
|
32
|
-
url =
|
|
32
|
+
url = url.startsWith("e:") ? convertShortchutForLink(rot13ToText(url.substring(2))) : url;
|
|
33
33
|
fetch(url, {
|
|
34
34
|
//headers: { "Content-Type": "application/json", Accept: "text/plain" },
|
|
35
35
|
method: "POST",
|
|
@@ -47,13 +47,14 @@ export function liveBlock(liveBlockAttribute = "data-live", liveFormSelector = "
|
|
|
47
47
|
});
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
'<
|
|
50
|
+
const spinner =
|
|
51
|
+
'<span class="border-top-color: transparent;" class="inline-block w-5 h-5 border-4 border-gray-50 border-solid rounded-full animate-spin"></span>';
|
|
52
|
+
const htmlLoader = "<div>" + spinner + "</div>";
|
|
52
53
|
|
|
53
54
|
var setLoader = function (form) {
|
|
54
55
|
var $submitButton = getSubmitButton(form);
|
|
55
56
|
if ($submitButton !== undefined) {
|
|
56
|
-
var initialButton = $submitButton.outerHTML;
|
|
57
|
+
//var initialButton = $submitButton.outerHTML;
|
|
57
58
|
$submitButton.innerHTML = "";
|
|
58
59
|
$submitButton.outerHTML = htmlLoader;
|
|
59
60
|
}
|
|
@@ -97,6 +98,10 @@ export function liveBlock(liveBlockAttribute = "data-live", liveFormSelector = "
|
|
|
97
98
|
// Listen button src-data-live
|
|
98
99
|
document.querySelectorAll("[src-" + liveBlockAttribute + "]").forEach((item) => {
|
|
99
100
|
item.addEventListener("click", (event) => {
|
|
101
|
+
if (item.tagName == "BUTTON") {
|
|
102
|
+
item.innerHTML = spinner;
|
|
103
|
+
item.setAttribute("disabled", true);
|
|
104
|
+
}
|
|
100
105
|
btnToBlock(event, item);
|
|
101
106
|
});
|
|
102
107
|
});
|