Sha256: 6a8c13836b7227108ad4fc28e41198a65c2908f78c6ba27942c2602682103806
Contents?: true
Size: 979 Bytes
Versions: 48
Compression:
Stored size: 979 Bytes
Contents
/* eslint-disable camelcase */ import { StreamActions } from '@hotwired/turbo' import { saveAs } from 'file-saver' // TODO: move these to the avo_filters gem StreamActions.close_filters_dropdown = function () { document.querySelector('.filters-dropdown-selector').classList.add('hidden') } StreamActions.open_filter = function () { const id = this.getAttribute('unique-id') setTimeout(() => { document.querySelector(`[data-filter-id="${id}"] .pill`).click() }, 150) } // END TODO: move these to the avo_filters gem // https://stackoverflow.com/a/77850750/9067704 StreamActions.download = function () { const byteCharacters = atob(this.getAttribute('content')) const byteNumbers = new Array(byteCharacters.length) for (let i = 0; i < byteCharacters.length; i++) { byteNumbers[i] = byteCharacters.charCodeAt(i) } const byteArray = new Uint8Array(byteNumbers) saveAs( new Blob( [byteArray], ), this.getAttribute('filename'), ) }
Version data entries
48 entries across 48 versions & 1 rubygems