import { createFragment } from "../../lib/skeleton/index.js"; import rxjs from "../../lib/rx.js"; import { qs } from "../../lib/dom.js"; import { join } from "../../lib/path.js"; import { animate, slideXOut } from "../../lib/animate.js"; import { loadCSS } from "../../helpers/loader.js"; import { get as getConfig } from "../../model/config.js"; import { getCurrentPath, getFilename } from "./common.js"; import { getMimeType } from "./mimetype.js"; import fscache from "../filespage/cache.js"; import { sort } from "../filespage/helper.js"; import { getState$ as getParams$, init as initParams } from "../filespage/state_config.js"; export default async function(render, { $img }) { const lsCache = await fscache().get(join(location, getCurrentPath() + "/../")); if (!lsCache) return; const params = await getParams$().pipe(rxjs.first()).toPromise(); const files = sort(lsCache.files, params["sort"], params["order"]); const currentFilename = getFilename(); const mimeTypes = getConfig("mime", {}); const state = { prev: null, curr: null, next: null, length: 0, }; for (let i=0; i