mirror of
https://github.com/captbaritone/webamp.git
synced 2026-08-03 15:34:25 +00:00
allow external *.wal
sample: http://localhost:8080/?skin=/assets/extracted/skins/MMD3.wal
This commit is contained in:
parent
b7c72ad414
commit
f8559f0b02
2 changed files with 17 additions and 4 deletions
|
|
@ -3,7 +3,7 @@ import JSZip from "jszip";
|
|||
import { classResolver } from "./skin/resolver";
|
||||
import SkinParser from "./skin/parse";
|
||||
import UI_ROOT from "./UIRoot";
|
||||
import { removeAllChildNodes } from "./utils";
|
||||
import { getUrlQuery, removeAllChildNodes } from "./utils";
|
||||
import { addDropHandler } from "./dropTarget";
|
||||
|
||||
function hack() {
|
||||
|
|
@ -22,9 +22,8 @@ function setStatus(status: string) {
|
|||
|
||||
async function main() {
|
||||
setStatus("Downloading skin...");
|
||||
// const response = await fetch("assets/CornerAmp_Redux.wal");
|
||||
// const response = await fetch("assets/Default_winamp3_build499.wal");
|
||||
const response = await fetch("assets/MMD3.wal");
|
||||
const skinPath = getUrlQuery(window.location, 'skin') || "assets/MMD3.wal";
|
||||
const response = await fetch(skinPath);
|
||||
const data = await response.blob();
|
||||
await loadSkin(data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,6 +80,20 @@ export function findLast<T>(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
export function getUrlQuery(location:Location, variable:string):string {
|
||||
var query = location.search.substring(1);
|
||||
var vars = query.split('&');
|
||||
for (var i = 0; i < vars.length; i++) {
|
||||
var pair = vars[i].split('=');
|
||||
if (decodeURIComponent(pair[0]) == variable) {
|
||||
return decodeURIComponent(pair[1]);
|
||||
}
|
||||
}
|
||||
console.log('Query variable %s not found', variable);
|
||||
return null;
|
||||
}
|
||||
|
||||
export class Emitter {
|
||||
_cbs: { [event: string]: Array<() => void> } = {};
|
||||
on(event: string, cb: () => void) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue