From e0241f01a9fa52abc06543bdcf73511c3063da91 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Sun, 21 Mar 2021 15:29:34 -0700 Subject: [PATCH] Explore HTML transform for normalizing Winamp forum HTML --- packages/winamp-forum-normalizer/.gitignore | 1 + packages/winamp-forum-normalizer/README.md | 6 + packages/winamp-forum-normalizer/example.html | 2086 +++++++++++++++++ packages/winamp-forum-normalizer/index.js | 21 + packages/winamp-forum-normalizer/package.json | 11 + packages/winamp-forum-normalizer/yarn.lock | 13 + 6 files changed, 2138 insertions(+) create mode 100644 packages/winamp-forum-normalizer/.gitignore create mode 100644 packages/winamp-forum-normalizer/README.md create mode 100644 packages/winamp-forum-normalizer/example.html create mode 100644 packages/winamp-forum-normalizer/index.js create mode 100644 packages/winamp-forum-normalizer/package.json create mode 100644 packages/winamp-forum-normalizer/yarn.lock diff --git a/packages/winamp-forum-normalizer/.gitignore b/packages/winamp-forum-normalizer/.gitignore new file mode 100644 index 0000000000..41077f8d25 --- /dev/null +++ b/packages/winamp-forum-normalizer/.gitignore @@ -0,0 +1 @@ +out.html \ No newline at end of file diff --git a/packages/winamp-forum-normalizer/README.md b/packages/winamp-forum-normalizer/README.md new file mode 100644 index 0000000000..8ef5afd431 --- /dev/null +++ b/packages/winamp-forum-normalizer/README.md @@ -0,0 +1,6 @@ +# Install and Run + +```bash +yarn install +node index.js +``` \ No newline at end of file diff --git a/packages/winamp-forum-normalizer/example.html b/packages/winamp-forum-normalizer/example.html new file mode 100644 index 0000000000..18f7d8d462 --- /dev/null +++ b/packages/winamp-forum-normalizer/example.html @@ -0,0 +1,2086 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Volume meter (%) to be permanently displayed - Winamp & Shoutcast Forums + + + + + + + +
+ + + + + +
+ + +
+ + +
+ + + +
+ +
+ +
+ + +
+
+ + + + +
+ +
+ + + + + + +
+ +
+ + + + + +
+
+
+ + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + +
+ + + + + + + + + + + +
Go Back Winamp & Shoutcast Forums + > Skinning and Design + + + > Modern Skins + +
+ + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Reply
+ + + + + + + + + + + + + + + + + + +
+ Thread Tools + + + Search this Thread + + + Display Modes + +
+ + + + + + +
+
+
+ + + + + + + + +
+ + + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ + Unread + Yesterday, 16:35 + + + +   + #1 + +
+ +
+ + Calvaria + + +
+ +
Junior Member
+ + + + + +
+  
+
Join Date: Nov 2010
+ + +
+ Posts: 16 +
+ + + + +
+
+ +
+ + + + +
+ + Volume meter (%) to be permanently displayed +
+
+ + + + +
+ + When you change the volume, the song data (songticker) is replaced by the volume meter. I'd like to have this volume meter displayed permanently (just the percentage, without the word "Volume) somewhere on the main player except the songticker. Is this possible? +
+ + + + + + + + + + + + + +
+ Calvaria is offline + + + + + + + + + + +   + + + + + + + Reply With Quote + + + + + + + + +
+ + + + + + + +
+ +
+
+
+ + + + + + + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ + Unread + Yesterday, 17:48 + + + +   + #2 + +
+ +
+ + ariszlo + + +
+ +
Major Dude
+ + + + + +
+  
+
Join Date: Jun 2015
+
Location: Hungary
+ +
+ Posts: 555 +
+ + + + +
+
+ +
+ + + + + +
+ + This is how you do it:
+
+Add the following lines somewhere between <groupdef id="group.mp.main"> and </groupdef> in main-player.xml:
+
+
PHP Code:
+
+ + +<text
  id
="VolPercentage"
  
display=""
  
x="380" y="80" w="80" h="32" align="center"
  
fontsize="32" color="255,255,255"
/>
<
script id="volpercentage" file="scripts/volpercentage.maki"/> 
+
+
+
+
+
Change the coordinates, size, alignment, fontsize and color as you like. Do not change anything else.
+
+Then copy volpercentage.m and volpercentage.maki into the scripts folder. +
+ + + + +
+ + + + + + + + +
+ Attached Files + + + + + +
File Type: zipvolpercentage.zip (1.7 KB, 2 views)
+
+ + + + +
+ + + + + + + + +
+
+ Vortex 1.04 +
+ + + + + + + +
+ ariszlo is offline + + + + + + + + + + +   + + + + + + + Reply With Quote + + + + + + + + +
+ + + + + + + +
+ +
+
+
+ + + + + + + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ + Unread + Yesterday, 20:06 + + + +   + #3 + +
+ +
+ + Calvaria + + +
+ +
Junior Member
+ + + + + +
+  
+
Join Date: Nov 2010
+ + +
+ Posts: 16 +
+ + + + +
+
+ +
+ + + + + +
+ + Wow, that's just awesome! Thanks a lot! +
+ + + + + + + + + + + + + +
+ Calvaria is offline + + + + + + + + + + +   + + + + + + + Reply With Quote + + + + + + + + +
+ + + + + + + +
+ +
+
+
+ + + +
+ + + + +
+
+
+ + + + + + + + + + + +
Reply
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
Go Back Winamp & Shoutcast Forums + > Skinning and Design + + + > Modern Skins + +
+ + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ « + Previous Thread + | + Next Thread + » +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Thread ToolsSearch this Thread
+ + + + + + + + +
+
+ + + + + Search this Thread:
+
+ Advanced Search +
+
+ + +
Display Modes
+ + + + + + + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + +
+ + Posting Rules +
+ +
You may not post new threads
+
You may not post replies
+
You may not post attachments
+
You may not edit your posts
+
+ +
BB code is On
+
Smilies are On
+
[IMG] code is On
+
HTML code is Off
+
+ +
+
+ + + + + +
+
+
+ + + Forum Jump
+ +
+
+
+
+ + +
+ + + +
+ + +
+ +
+
+
+ + + + +
+ + + + + + + + +
+ + +
+ + + Winamp.com - + Help - + + + Archive - + + + + Top + +
+
+
+ +
+ + + + + + + + + + + + +
+ +
+ + +
+ + + + + + + + + + + + + + +
+ + + + +
+ + + + + +
+ + + \ No newline at end of file diff --git a/packages/winamp-forum-normalizer/index.js b/packages/winamp-forum-normalizer/index.js new file mode 100644 index 0000000000..f3be44e961 --- /dev/null +++ b/packages/winamp-forum-normalizer/index.js @@ -0,0 +1,21 @@ +import fs from "fs"; +import Hat from "html-ast-transform"; + +const { transform, h, getAttr, hasClass } = Hat; + +const replaceTags = { + code: (node) => { + return h("h1", [], [h("#text", "Hello")]); + }, +}; + +function clean(html) { + return transform(html, { replaceTags }); +} + +function main(fileName, output) { + const html = fs.readFileSync(fileName, { encoding: "utf8" }); + fs.writeFileSync(output, clean(html)); +} + +main("./example.html", "out.html"); diff --git a/packages/winamp-forum-normalizer/package.json b/packages/winamp-forum-normalizer/package.json new file mode 100644 index 0000000000..1c52d9880d --- /dev/null +++ b/packages/winamp-forum-normalizer/package.json @@ -0,0 +1,11 @@ +{ + "name": "winamp-forum-normalizer", + "version": "1.0.0", + "main": "index.js", + "license": "MIT", + "type": "module", + "dependencies": { + "html-ast-transform": "^2.0.1", + "parse5": "^6.0.1" + } +} diff --git a/packages/winamp-forum-normalizer/yarn.lock b/packages/winamp-forum-normalizer/yarn.lock new file mode 100644 index 0000000000..0c6307d78e --- /dev/null +++ b/packages/winamp-forum-normalizer/yarn.lock @@ -0,0 +1,13 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +html-ast-transform@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/html-ast-transform/-/html-ast-transform-2.0.1.tgz#404f7cac93f8aecd425ee3e381718e5e253eaded" + integrity sha512-ryBf1oxFM1s12/lD2qChqrdsG0Y2ajdCZJnNPjY2oeS+UDF3wwYP7ubP0wxM6h72dKxdgtmihAc55x3gtDqM4Q== + +parse5@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" + integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==