Make reference and version JS populated

master
William Toohey 10 years ago
parent 44bd6858cb
commit 2102576c01
  1. 2
      Makefile
  2. 43
      index-min.html
  3. 44
      index.html
  4. 1
      js/HuesCore.js
  5. 102
      js/HuesInfo.js

@ -1,4 +1,4 @@
JS=HuesCanvas.js HuesCore.js HuesSettings.js HuesUI.js ResourceManager.js ResourcePack.js SoundManager.js
JS=HuesCanvas.js HuesCore.js HuesSettings.js HuesUI.js HuesInfo.js ResourceManager.js ResourcePack.js SoundManager.js
YUI=yuicompressor-2.4.8.jar
all: minify pack

@ -53,50 +53,13 @@
</div>
<div id="tab3-content" class="tab-content">
<div id="about">
<h1>0x40 Hues of JS, v1.0</h1>
<h1>0x40 Hues of JS, <span id="versionText"><!-- Populated by HuesInfo.js --></span></h1>
<h2>Adapted from the <a target="_blank" href="http://0x40hues.blogspot.com">0x40 Flash</a></h2>
<h2>Web-ified by <a target="_blank" href="https://github.com/mon">mon</a></h2>
<h3>With help from <a target="_blank" href="https://github.com/kepstin/0x40hues-html5">Kepstin</a></h3>
</div>
<div id="reference">
<div class="info-ref">
<h3>Beat glossary</h3>
<ul>
<li>x Vertical blur (snare)</li>
<li>o Horizontal blur (bass)</li>
<li>- No blur</li>
<li>+ Blackout</li>
<li>| Short blackout</li>
<li>: Color only</li>
<li>* Image only</li>
<li>X Vertical blur only</li>
<li>O Horizontal blur only</li>
<li>~ Fade color</li>
<li>= Fade and change image</li>
<li>i Invert all colours</li>
<li>I Invert &amp; change image</li>
</ul>
</div>
<div class="info-ref">
<h3>Keyboard shortcuts</h3>
<ul>
<li>↑↓ Change song</li>
<li>←→ Change image</li>
<li>[SHIFT] Random song</li>
<li>-+ Change volume</li>
<li>[M] Toggle mute</li>
<li>[F] Toggle automode</li>
<li>[H] Toggle UI hide</li>
<li>[C] Character list</li>
<li>[S] Song list</li>
<li>[W] Toggle window</li>
<li>[R] Resource packs</li>
<li>[O] Options</li>
<li>[I] Information</li>
<li>[1-5] Change UI</li>
</ul>
</div>
</div>
<!-- Populated by HuesInfo.js -->
<div id="reference"></div>
</div>
</div>
</div>

@ -14,6 +14,7 @@
<script type="text/javascript" src="js/HuesCore.js"></script>
<script type="text/javascript" src="js/HuesSettings.js"></script>
<script type="text/javascript" src="js/HuesUI.js"></script>
<script type="text/javascript" src="js/HuesInfo.js"></script>
<script type="text/javascript" src="js/HuesCanvas.js"></script>
<script type="text/javascript" src="js/ResourcePack.js"></script>
<script type="text/javascript" src="js/ResourceManager.js"></script>
@ -64,50 +65,13 @@
</div>
<div id="tab3-content" class="tab-content">
<div id="about">
<h1>0x40 Hues of JS, v1.0</h1>
<h1>0x40 Hues of JS, <span id="versionText"><!-- Populated by HuesInfo.js --></span></h1>
<h2>Adapted from the <a target="_blank" href="http://0x40hues.blogspot.com">0x40 Flash</a></h2>
<h2>Web-ified by <a target="_blank" href="https://github.com/mon">mon</a></h2>
<h3>With help from <a target="_blank" href="https://github.com/kepstin/0x40hues-html5">Kepstin</a></h3>
</div>
<div id="reference">
<div class="info-ref">
<h3>Beat glossary</h3>
<ul>
<li>x Vertical blur (snare)</li>
<li>o Horizontal blur (bass)</li>
<li>- No blur</li>
<li>+ Blackout</li>
<li>| Short blackout</li>
<li>: Color only</li>
<li>* Image only</li>
<li>X Vertical blur only</li>
<li>O Horizontal blur only</li>
<li>~ Fade color</li>
<li>= Fade and change image</li>
<li>i Invert all colours</li>
<li>I Invert &amp; change image</li>
</ul>
</div>
<div class="info-ref">
<h3>Keyboard shortcuts</h3>
<ul>
<li>↑↓ Change song</li>
<li>←→ Change image</li>
<li>[SHIFT] Random song</li>
<li>-+ Change volume</li>
<li>[M] Toggle mute</li>
<li>[F] Toggle automode</li>
<li>[H] Toggle UI hide</li>
<li>[C] Character list</li>
<li>[S] Song list</li>
<li>[W] Toggle window</li>
<li>[R] Resource packs</li>
<li>[O] Options</li>
<li>[I] Information</li>
<li>[1-5] Change UI</li>
</ul>
</div>
</div>
<!-- Populated by HuesInfo.js -->
<div id="reference"></div>
</div>
</div>
</div>

@ -115,6 +115,7 @@ function HuesCore(defaults) {
}.bind(this);
console.log("0x40 Hues - start your engines!");
populateHuesInfo(this.version);
this.colours = this.oldColours;
this.uiArray = [];
this.lastSongArray = [];

@ -0,0 +1,102 @@
/* Copyright (c) 2015 William Toohey <will@mon.im>
* Portions Copyright (c) 2015 Calvin Walton <calvin.walton@kepstin.ca>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/* HuesInfo.js populates the beat glossary, shortcut list, and version string.
* This means the HTML should rarely need to be updated.
* If the element IDs are not present, the DOM is not modified. If you would
* like a custom info page, simply leave them out.
*/
var huesInfo = {
versionID: "versionText",
referenceID: "reference",
referenceClass: "info-ref"
};
var beatGlossary = [
"x Vertical blur (snare)",
"o Horizontal blur (bass)",
"- No blur",
"+ Blackout",
"| Short blackout",
": Color only",
"* Image only",
"X Vertical blur only",
"O Horizontal blur only",
"~ Fade color",
"= Fade and change image",
"i Invert all colours",
"I Invert & change image"
];
var shortcuts = [
"↑↓ Change song",
"←→ Change image",
"[SHIFT] Random song",
"-+ Change volume",
"[M] Toggle mute",
"[F] Toggle automode",
"[H] Toggle UI hide",
"[C] Character list",
"[S] Song list",
"[W] Toggle window",
"[R] Resource packs",
"[O] Options",
"[I] Information",
"[1-5] Change UI"
];
function populateHuesInfo(version) {
var versionInt = parseInt(version);
var versionElem = document.getElementById(huesInfo.versionID);
if(versionElem) {
versionElem.textContent = "v" + (versionInt/10).toFixed(1);
}
addInfo("Beat glossary", beatGlossary);
addInfo("Keyboard shortcuts", shortcuts);
};
var addInfo = function(titleText, list) {
var refElem = document.getElementById(huesInfo.referenceID);
if(!refElem) {
return;
}
var info = document.createElement("div");
info.className = huesInfo.referenceClass;
refElem.appendChild(info);
var title = document.createElement("h3");
title.textContent = titleText;
info.appendChild(title);
var listElem = document.createElement("ul");
list.forEach(function(elem) {
var item = document.createElement("li");
item.textContent = elem;
listElem.appendChild(item);
});
info.appendChild(listElem);
};
Loading…
Cancel
Save