spotifylookup/bits/psuedoframework.js

30 lines
687 B
JavaScript
Raw Normal View History

2022-01-04 18:19:03 +00:00
module.exports.createDocument = function(stylesheet, content) {
return `
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Spotify results</title>
<style>${stylesheet}</style>
</head>
<body>
${content}
</body>
</html>
`;
}
module.exports.$ = function(name, content, classList) {
return {
toString: () => `<${name}${classList && classList.length ? ` class="${classList.join(',')}"` : ''}>${content ? content.toString() : ''}</${name}>`,
append: function ($el) {
content = content ? content + $el.toString() : $el.toString();
return this;
},
html: function(text) {
content = text;
return this;
}
};
}