aboutsummaryrefslogtreecommitdiff
path: root/src/js/arching-kaos-modules-mixtapes.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/arching-kaos-modules-mixtapes.js')
-rw-r--r--src/js/arching-kaos-modules-mixtapes.js29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/js/arching-kaos-modules-mixtapes.js b/src/js/arching-kaos-modules-mixtapes.js
index ac23ed4..56cdfd6 100644
--- a/src/js/arching-kaos-modules-mixtapes.js
+++ b/src/js/arching-kaos-modules-mixtapes.js
@@ -1,12 +1,15 @@
-/* Arching Kaos Model Mixtapes
- *
- * Kaotisk Hund - 2024
- *
- * @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL v3.0
- *
- */
+// Arching Kaos Model Mixtapes
+//
+// Kaotisk Hund - 2024
+//
+// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL v3.0
+//
-function akModuleMixtapes(zblockIPFSHash, zblockObject, blockObject, json){
+import { makeElement } from "./arching-kaos-generator.js";
+import { getIPFSURL } from "./url-generators.js";
+import { addMixtapeID, setMixtape, getMixtapes } from "./environment-setup.js";
+
+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,9 +55,9 @@ function akModuleMixtapes(zblockIPFSHash, zblockObject, blockObject, json){
gpg:blockObject.gpg,
timestamp:blockObject.timestamp,
audioDuration:audio.duration
- };
+ });
}
- /* console.log(
+ /* debugLog(
zblockIPFSHash+"'s duration is: "+
audio.duration +
" Ceiled: " + Math.ceil(audio.duration) +