Sha256: 12b3deb93126a1c17b9a9359ce766f9ee080a12a052ff4dab70d7ff81a01de7a
Contents?: true
Size: 858 Bytes
Versions: 94
Compression:
Stored size: 858 Bytes
Contents
export default class Format { constructor() { this.formatSelector = $('.js-format-selector')[0] if (this.formatSelector) { this.formatChanged(this.formatSelector.value, false) $(this.formatSelector).change((event) => this.formatChanged(event.target.value)) this.restoreFormat() } } formatChanged(format, persist = true) { $('.js-format').hide() $(`.js-format[data-format='${format}']`).show() if (persist) { this.persistFormat(format) } } persistFormat(format) { if (window.localStorage) { window.localStorage.setItem('format', format) } } restoreFormat() { if (window.localStorage) { const format = window.localStorage.getItem('format') if (format) { $(this.formatSelector).val(format) this.formatChanged(format, false) } } } }
Version data entries
94 entries across 94 versions & 1 rubygems