diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-11-29 16:23:39 +0200 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-11-29 16:23:39 +0200 |
commit | afcedd44615d20423d58f4d9c9d8cfa3838a54d4 (patch) | |
tree | e16cd7f2eb4040f7b237baa45aa3f8f80516dcc4 /src/js/arching-kaos-modules-mixtapes.js | |
parent | 084e3ce6efc49c2d43ce9b44d96e430f8057848e (diff) | |
download | arching-kaos-web-ui-afcedd44615d20423d58f4d9c9d8cfa3838a54d4.tar.gz arching-kaos-web-ui-afcedd44615d20423d58f4d9c9d8cfa3838a54d4.tar.bz2 arching-kaos-web-ui-afcedd44615d20423d58f4d9c9d8cfa3838a54d4.zip |
Major refactoring
Diffstat (limited to 'src/js/arching-kaos-modules-mixtapes.js')
-rw-r--r-- | src/js/arching-kaos-modules-mixtapes.js | 13 |
1 files changed, 8 insertions, 5 deletions
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: "+ |