Skip to content

Save user chosen bundles #1035

@cecekpawon

Description

@cecekpawon

Could you please add like little snippets below to official download page, to save user chosen bundles?

var key = "hljsbundle", hljsbundle = JSON.parse(localStorage.getItem(key)) || {};
$("#download-form input[type='checkbox']").each(function(){
  var propname = $(this).prop("name");
  if (!hljsbundle.hasOwnProperty(propname)) {
    hljsbundle[propname] = $(this).prop("checked") ? 1 : 0;
  }
  $(this)
    .prop("checked", (hljsbundle[propname] === 1))
    .click(function(){
      hljsbundle[propname] = $(this).prop("checked") ? 1 : 0;
      localStorage.setItem(key, JSON.stringify(hljsbundle));
    });
});

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions