From afcedd44615d20423d58f4d9c9d8cfa3838a54d4 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Fri, 29 Nov 2024 16:23:39 +0200 Subject: Major refactoring --- src/js/arching-kaos-modules-mixtapes.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/js/arching-kaos-modules-mixtapes.js') diff --git a/src/js/arching-kaos-modules-mixtapes.js b/src/js/arching-kaos-modules-mixtapes.js index ac23ed4..bf11d9d 100644 --- a/src/js/arching-kaos-modules-mixtapes.js +++ b/src/js/arching-kaos-modules-mixtapes.js @@ -5,8 +5,11 @@ * @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL v3.0 * */ +import { makeElement } from "./arching-kaos-generator.js"; +import { getIPFSURL } from "./url-generators.js"; +import { addMixtapeID, setMixtape, getMixtapes } from "./environment-setup.js"; -function akModuleMixtapes(zblockIPFSHash, zblockObject, blockObject, json){ +export function akModuleMixtapes(zblockIPFSHash, zblockObject, blockObject, json){ if(!document.querySelector('#mixtape-'+zblockIPFSHash)){ var divs = document.querySelector('#mixtapes-section'); var art = { @@ -37,10 +40,10 @@ function akModuleMixtapes(zblockIPFSHash, zblockObject, blockObject, json){ makeElement(art, divs); var audio = document.querySelector('#mixtape-player-'+zblockIPFSHash); audio.setAttribute('controls',''); - mixtapeIds.push('mixtape-player-'+zblockIPFSHash); + addMixtapeID(zblockIPFSHash); audio.addEventListener( "loadedmetadata", ()=>{ - if ( mixtapes[zblockIPFSHash] === undefined ){ - mixtapes[zblockIPFSHash]={ + if ( getMixtapes()[zblockIPFSHash] === undefined ){ + setMixtape(zblockIPFSHash, { zblock:zblockIPFSHash, block:zblockObject.block, block_signature:zblockObject.block_signature, @@ -52,7 +55,7 @@ function akModuleMixtapes(zblockIPFSHash, zblockObject, blockObject, json){ gpg:blockObject.gpg, timestamp:blockObject.timestamp, audioDuration:audio.duration - }; + }); } /* console.log( zblockIPFSHash+"'s duration is: "+ -- cgit v1.2.3