@pushword/js-helper 0.0.63 → 0.0.64

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/helpers.js +8 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushword/js-helper",
3
- "version": "0.0.63",
3
+ "version": "0.0.64",
4
4
  "description": "Pushword front end helpers. ",
5
5
  "author": "Robin@PiedWeb <contact@piedweb.com>",
6
6
  "license": "MIT",
package/src/helpers.js CHANGED
@@ -29,7 +29,10 @@ export function liveBlock(liveBlockAttribute = "data-live", liveFormSelector = "
29
29
 
30
30
  var getLiveBlock = function (item) {
31
31
  var url = item.getAttribute(liveBlockAttribute);
32
+ console.log(url);
33
+ console.log(url.startsWith("e:"));
32
34
  url = url.startsWith("e:") ? convertShortchutForLink(rot13ToText(url.substring(2))) : url;
35
+ console.log(url);
33
36
  fetch(url, {
34
37
  //headers: { "Content-Type": "application/json", Accept: "text/plain" },
35
38
  method: "POST",
@@ -48,8 +51,8 @@ export function liveBlock(liveBlockAttribute = "data-live", liveFormSelector = "
48
51
  };
49
52
 
50
53
  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>";
54
+ '<span style="border-top-color: transparent" class="inline-block w-5 h-5 border-4 border-gray-50 border-solid rounded-full animate-spin"></span>';
55
+ const htmlLoader = "<div class=btn-link>" + spinner + "</div>";
53
56
 
54
57
  var setLoader = function (form) {
55
58
  var $submitButton = getSubmitButton(form);
@@ -285,13 +288,13 @@ export function convertFormFromRot13(attribute = "data-frot") {
285
288
 
286
289
  export function convertShortchutForLink(str) {
287
290
  if (str.charAt(0) == "-") {
288
- return str.replace("-", "http://");
291
+ return "http://" + str.substring(1);
289
292
  }
290
293
  if (str.charAt(0) == "_") {
291
- return str.replace("_", "https://");
294
+ return "https://" + str.substring(1);
292
295
  }
293
296
  if (str.charAt(0) == "@") {
294
- return str.replace("@", "mailto:");
297
+ return "mailto:" + str.substring(1);
295
298
  }
296
299
  return str;
297
300
  }