Sha256: 86d8ad46ad03581c1bb7a00a4e81be9aa901a0f38642dd7fed7784032497c1cb

Contents?: true

Size: 1.06 KB

Versions: 46

Compression:

Stored size: 1.06 KB

Contents

$(function() {
  if (!window.localStorage) {
    return;
  }

  let getDismissedHelpers = () => {
    let serialized = localStorage.getItem("dismissedHelpers");
    if (!serialized) {
      return [];
    }

    return serialized.split(",");
  };

  let addDismissedHelper = (id) => {
    let dismissedHelpers = getDismissedHelpers();

    if (!dismissedHelpers.includes(id)) {
      localStorage.setItem(
        "dismissedHelpers",
        [...dismissedHelpers, id].join(",")
      );
    }
  };

  let dismissedHelpers = getDismissedHelpers();

  $(".floating-helper-container").each((_index, elem) => {
    let id = $(elem).data("help-id");

    $(
      ".floating-helper__trigger, .floating-helper__content-close",
      elem
    ).on("click", (ev) => {
      ev.preventDefault();
    });

    if (!dismissedHelpers.includes(id)) {
      $(".floating-helper", elem).foundation("toggle");
      $(".floating-helper__wrapper", elem).foundation("toggle");

      $(".floating-helper", elem).on("off.zf.toggler", () => {
        addDismissedHelper(id);
      });
    }
  });
});

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
decidim-core-0.23.3 app/assets/javascripts/decidim/floating_help.js.es6
decidim-core-0.23.2 app/assets/javascripts/decidim/floating_help.js.es6
decidim-core-0.23.1 app/assets/javascripts/decidim/floating_help.js.es6
decidim-core-0.23.1.rc1 app/assets/javascripts/decidim/floating_help.js.es6
decidim-core-0.23.0 app/assets/javascripts/decidim/floating_help.js.es6
decidim-core-0.22.0 app/assets/javascripts/decidim/floating_help.js.es6